/* assets/css/app.css - Complete Responsive Stylesheet for 3D Live Agent Office & 12-Agent Real Estate Dashboard */
@import url('./tokens.css');

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

html, body {
  width: 100%;
  min-height: 100dvh;
  overflow-x: hidden;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: var(--lh-base);
  color: var(--text-primary);
  background: var(--bg-app);
  -webkit-font-smoothing: antialiased;
}

/* App Shell */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  width: 100%;
}

/* Top Command Header */
.top-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  padding: var(--space-3) clamp(12px, 2.2vw, 24px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.brand-cluster {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #1E3A8A, #2563EB);
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

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

.brand-titles h1 {
  font-size: var(--fs-base);
  font-weight: 800;
  color: var(--text-primary);
  line-height: var(--lh-tight);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-subtitle {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  white-space: nowrap;
}

.live-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--path-green);
  display: inline-block;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.2);
  animation: pulseRing 2s infinite;
}

@keyframes pulseRing {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.18); opacity: 0.75; }
}

/* Primary Mode Switcher Tabs */
.nav-tabs {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  background: var(--bg-surface-subtle);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.nav-tab {
  height: 36px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), transform var(--dur-instant);
}

.nav-tab:hover {
  color: var(--text-primary);
  background: rgba(15, 23, 42, 0.04);
}

.nav-tab:active {
  transform: scale(0.98);
}

.nav-tab:focus-visible {
  outline: 2px solid var(--brand-blue);
  outline-offset: 2px;
}

.nav-tab.active {
  background: var(--brand-blue);
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.28);
}

.nav-tab-badge {
  font-size: 0.70rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: rgba(15, 23, 42, 0.08);
  color: inherit;
}

.nav-tab.active .nav-tab-badge {
  background: rgba(255, 255, 255, 0.22);
  color: #FFFFFF;
}

/* Header Action Buttons */
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

/* Standard Reusable Buttons (Rule 17 & 18) */
.btn {
  height: var(--control-h-md);
  padding: 0 var(--space-4);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), transform var(--dur-instant), box-shadow var(--dur-fast);
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:focus-visible {
  outline: 2px solid var(--brand-blue);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-sm {
  height: var(--control-h-sm);
  padding: 0 var(--space-3);
  font-size: var(--fs-xs);
}

.btn-primary {
  background: var(--brand-blue);
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover:not(:disabled) {
  background: var(--brand-blue-hover);
}

.btn-success {
  background: var(--path-green);
  color: #FFFFFF;
}

.btn-success:hover:not(:disabled) {
  background: #15803D;
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-surface-subtle);
  border-color: #94A3B8;
}

.btn-danger {
  background: var(--path-red);
  color: #FFFFFF;
}

.btn-danger:hover:not(:disabled) {
  background: #B91C1C;
}

/* KPI Strip Bar */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 175px), 1fr));
  gap: var(--space-3);
  padding: var(--space-3) clamp(12px, 2.2vw, 24px);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}

.kpi-pill-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  min-width: 0;
  transition: transform var(--dur-fast) var(--ease-out), border-color var(--dur-fast);
}

.kpi-pill-card:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
}

.kpi-info {
  min-width: 0;
}

.kpi-label {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-value {
  font-size: var(--fs-xl);
  font-weight: 800;
  color: var(--text-primary);
  font-family: var(--font-mono);
  line-height: 1.2;
  margin-top: 2px;
}

.kpi-sub {
  font-size: 0.72rem;
  font-weight: 600;
  margin-top: 2px;
  white-space: nowrap;
}

.kpi-icon-box {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* View Panels */
.view-panel {
  display: none;
  flex: 1;
  width: 100%;
}

.view-panel.active {
  display: flex;
  flex-direction: column;
}

/* ============================================================================
   VIEW 1: 3D ISOMETRIC LIVE AGENT WORKSPACE (MATCHES INSTAGRAM REEL)
   ============================================================================ */
.iso-workspace-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 370px;
  gap: 0;
  flex: 1;
  min-height: calc(100dvh - 155px);
  position: relative;
}

@media (max-width: 1120px) {
  .iso-workspace-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

.iso-stage-container {
  position: relative;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at 50% 42%, #F6F3FF 0%, #EDE7F8 55%, #E3DCF2 100%);
  overflow: hidden;
  min-height: 560px;
}

/* Top-Left Status Line inside 3D Canvas (Exact Match to Reel: "12 agents working. Click any employee to inspect...") */
.iso-hud-top {
  position: absolute;
  top: var(--space-4);
  left: var(--space-4);
  right: var(--space-4);
  z-index: 20;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  pointer-events: none;
  flex-wrap: wrap;
}

.iso-hud-status-pill {
  pointer-events: auto;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(124, 58, 237, 0.18);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-4);
  box-shadow: var(--shadow-md);
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.iso-hud-status-pill strong {
  color: var(--brand-blue);
  font-weight: 800;
}

.iso-camera-controls {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: var(--space-1);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  padding: 5px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-md);
  flex-wrap: wrap;
}

.cam-btn {
  height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  transition: all var(--dur-fast);
}

.cam-btn:hover {
  background: var(--bg-surface-subtle);
  color: var(--text-primary);
}

.cam-btn.active {
  background: var(--bg-charcoal);
  color: #FFFFFF;
}

/* Interactive 3D Canvas & DOM Overlay Layer */
.iso-canvas-wrap {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 490px;
  cursor: grab;
  user-select: none;
}

.iso-canvas-wrap:active {
  cursor: grabbing;
}

#iso3dCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Floating In-Scene 3D HTML Overlays (Agent Name Pills & Dark Action Bubbles from Reference Reel) */
.iso-overlay-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 12;
}

/* Floating White Agent Name Pill (e.g. "● Maya", "● Zara", "● Neil") */
.agent-floating-pill {
  position: absolute;
  transform: translate(-50%, -100%);
  pointer-events: auto;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: var(--radius-pill);
  padding: 3px 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-primary);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.10);
  white-space: nowrap;
  cursor: pointer;
  transition: transform 150ms var(--ease-out), box-shadow 150ms var(--ease-out), border-color 150ms;
}

.agent-floating-pill:hover,
.agent-floating-pill.selected {
  transform: translate(-50%, -108%) scale(1.06);
  border-color: var(--brand-blue);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.25);
  z-index: 25;
}

.pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pill-num {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* Floating Dark Charcoal Action Bubble above Agent (Exact Match to Instagram Reel: Zara "Pick ▸", Sam "Decide ▸", Kabir "Review ▸") */
.agent-dark-bubble {
  position: absolute;
  transform: translate(-50%, -100%);
  pointer-events: auto;
  background: #141824;
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  padding: 7px 9px 7px 12px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-bubble);
  max-width: 265px;
  white-space: nowrap;
  z-index: 22;
  cursor: pointer;
  animation: floatBubble 2.8s ease-in-out infinite;
}

@keyframes floatBubble {
  0%, 100% { margin-top: 0; }
  50% { margin-top: -4px; }
}

.agent-dark-bubble::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px 6px 0;
  border-style: solid;
  border-color: #141824 transparent transparent;
}

.bubble-text-col {
  min-width: 0;
  overflow: hidden;
}

.bubble-agent-name {
  font-size: 0.70rem;
  font-weight: 800;
  color: #93C5FD;
  line-height: 1.1;
}

.bubble-prompt {
  font-size: 0.72rem;
  color: #E2E8F0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 170px;
}

.bubble-cta-btn {
  background: #2563EB;
  color: #FFFFFF;
  border: none;
  border-radius: 7px;
  padding: 5px 10px;
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: background 150ms;
}

.bubble-cta-btn:hover {
  background: #3B82F6;
}

/* Pinned Bottom Human-in-the-Loop Decision Bar (Exact Match to Instagram Reference Reel Bottom Cards!) */
.decision-approval-bar {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-lavender);
  padding: var(--space-3) var(--space-4);
  z-index: 25;
}

.decision-bar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  flex-wrap: wrap;
}

.decision-bar-title {
  font-size: var(--fs-xs);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.decision-cards-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 255px), 1fr));
  gap: var(--space-3);
}

.decision-card {
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}

.decision-card:hover {
  border-color: var(--brand-blue-border);
  box-shadow: var(--shadow-md);
}

.decision-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #FFFFFF;
  font-weight: 800;
  font-size: 0.80rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.decision-body {
  flex: 1;
  min-width: 0;
}

.decision-meta {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #D97706;
  margin-bottom: 2px;
}

.decision-question {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
  margin-bottom: var(--space-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.decision-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.btn-decide-blue {
  height: 28px;
  padding: 0 11px;
  border-radius: 6px;
  border: none;
  background: #2563EB;
  color: #FFFFFF;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.btn-decide-blue:hover {
  background: #1D4ED8;
}

.btn-approve-ghost {
  height: 28px;
  padding: 0 11px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--bg-surface-subtle);
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.btn-approve-ghost:hover {
  background: #E2E8F0;
  color: var(--text-primary);
}

/* Right Sidebar: Live Agent Inspector & Real-Time Activity Stream */
.inspector-sidebar {
  background: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 155px);
  overflow-y: auto;
}

@media (max-width: 1120px) {
  .inspector-sidebar {
    max-height: none;
    border-left: none;
    border-top: 1px solid var(--border-subtle);
  }
}

.inspector-section {
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
}

.inspector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.inspector-agent-card {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-3);
}

.agent-badge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-tag.working {
  background: var(--path-green-soft);
  color: var(--path-green);
  border: 1px solid var(--path-green-border);
}

.status-tag.attention {
  background: var(--path-orange-soft);
  color: var(--path-orange);
  border: 1px solid var(--path-orange-border);
}

.status-tag.hot {
  background: var(--path-green-soft);
  color: var(--path-green);
  border: 1px solid var(--path-green-border);
}

.status-tag.warm {
  background: var(--path-orange-soft);
  color: var(--path-orange);
  border: 1px solid var(--path-orange-border);
}

.status-tag.lost {
  background: var(--path-red-soft);
  color: var(--path-red);
  border: 1px solid var(--path-red-border);
}

.agent-roster-mini {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
}

.roster-chip {
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  min-width: 0;
  transition: all var(--dur-fast);
}

.roster-chip:hover {
  border-color: var(--brand-blue-border);
  background: var(--brand-blue-soft);
}

.roster-chip.active {
  border-color: var(--brand-blue);
  background: var(--brand-blue-soft);
  box-shadow: 0 0 0 1px var(--brand-blue);
}

.roster-chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.roster-chip-text {
  min-width: 0;
  overflow: hidden;
}

.roster-chip-name {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.roster-chip-role {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Live Stream Feed */
.stream-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.stream-item {
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--bg-surface-subtle);
  border-left: 3px solid var(--brand-blue);
  font-size: 0.78rem;
}

.stream-item.green { border-left-color: var(--path-green); }
.stream-item.amber, .stream-item.orange { border-left-color: var(--path-orange); }
.stream-item.red { border-left-color: var(--path-red); }
.stream-item.teal { border-left-color: var(--path-teal); }

.stream-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  font-size: 0.70rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 3px;
}

/* ============================================================================
   VIEW 2: EXACT 12-AI-AGENT WORKFLOW ARCHITECTURE DIAGRAM (FROM USER SCREENSHOT)
   ============================================================================ */
.workflow-diagram-container {
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
  padding: var(--space-6) clamp(16px, 3vw, 32px);
}

.wf-legend-banner {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-6);
  margin-bottom: var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}

.wf-path-badges {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.wf-path-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  font-weight: 700;
  white-space: nowrap;
}

.wf-board {
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-8) var(--space-6);
  box-shadow: var(--shadow-md);
  position: relative;
}

.wf-spine {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  max-width: 920px;
  margin: 0 auto;
}

.wf-node {
  width: 100%;
  max-width: 340px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-strong);
  background: #FFFFFF;
  text-align: center;
  position: relative;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast);
}

.wf-node:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.wf-node.blue {
  background: #EBF5FF;
  border-color: #2563EB;
}

.wf-node.neutral {
  background: #FFFFFF;
  border-color: #CBD5E1;
}

.wf-node.orange {
  background: #FFF1E6;
  border-color: #D97706;
}

.wf-node.amber {
  background: #FEF9C3;
  border-color: #CA8A04;
}

.wf-node.green {
  background: #DCFCE7;
  border-color: #16A34A;
}

.wf-node.red {
  background: #FEE2E2;
  border-color: #DC2626;
}

.wf-node.teal {
  background: #CCFBF1;
  border-color: #0D9488;
}

.wf-node.slate {
  background: #E2E8F0;
  border-color: #334155;
}

.wf-node-title {
  font-size: var(--fs-base);
  font-weight: 800;
  color: var(--text-primary);
}

.wf-node-sub {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  margin-top: 2px;
}

.wf-node-counter {
  position: absolute;
  top: -10px;
  right: -10px;
  background: var(--bg-charcoal);
  color: #FFFFFF;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.wf-arrow-down {
  color: #94A3B8;
  font-size: 0.85rem;
  line-height: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.wf-diamond {
  width: 170px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 2px solid #94A3B8;
  background: #F8FAFC;
  text-align: center;
  font-weight: 800;
  font-size: var(--fs-sm);
  color: var(--text-primary);
}

.wf-branch-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-6);
  width: 100%;
  margin-top: var(--space-2);
  align-items: start;
}

@media (max-width: 768px) {
  .wf-branch-grid {
    grid-template-columns: 1fr;
  }
}

.wf-branch-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border-strong);
}

.wf-branch-col.green-zone {
  background: rgba(240, 253, 244, 0.55);
  border-color: #86EFAC;
}

.wf-branch-col.orange-red-zone {
  background: rgba(255, 251, 235, 0.55);
  border-color: #FCD34D;
}

.wf-loop-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.73rem;
  font-weight: 800;
}

.wf-bg-box {
  margin-top: var(--space-8);
  background: #F1F5F9;
  border: 2px solid #CBD5E1;
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  text-align: center;
}

.wf-bg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: var(--space-4);
  margin: var(--space-4) 0;
}

/* ============================================================================
   VIEW 3 & 4: CRM PIPELINE, MULTI-CHANNEL CONSOLE & SETTINGS
   ============================================================================ */
.dashboard-container {
  max-width: 1360px;
  width: 100%;
  margin: 0 auto;
  padding: var(--space-6) clamp(16px, 2.5vw, 32px);
}

.grid-2col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: var(--space-6);
}

.grid-3col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 310px), 1fr));
  gap: var(--space-4);
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.card-title {
  font-size: var(--fs-lg);
  font-weight: 800;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr));
  gap: var(--space-3);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: var(--space-3);
}

.form-label {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-secondary);
}

.form-input, .form-select, .form-textarea {
  height: var(--control-h-md);
  padding: 0 var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: #FFFFFF;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 1rem;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}

.form-textarea {
  height: auto;
  min-height: 84px;
  padding: var(--space-2) var(--space-3);
  resize: vertical;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Data Tables */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: var(--fs-sm);
}

.data-table th {
  background: var(--bg-surface-subtle);
  padding: 11px 14px;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: rgba(248, 250, 252, 0.8);
}

/* Custom Toast & Modal System (Rule 14: Never use browser alert/confirm/prompt) */
.toast-stack {
  position: fixed;
  bottom: var(--space-5);
  right: var(--space-5);
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: 380px;
  width: calc(100% - 32px);
  pointer-events: none;
}

.toast-item {
  pointer-events: auto;
  background: #141824;
  color: #FFFFFF;
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  border-left: 4px solid var(--brand-blue);
  animation: toastSlideIn 220ms var(--ease-out);
}

.toast-item.success { border-left-color: var(--path-green); }
.toast-item.error { border-left-color: var(--path-red); }
.toast-item.warning { border-left-color: var(--path-orange); }

@keyframes toastSlideIn {
  from { transform: translateY(16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.modal-backdrop.open {
  display: flex;
}

.modal-panel {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  max-width: 580px;
  width: 100%;
  max-height: 90dvh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-subtle);
  animation: modalPop 200ms var(--ease-out);
}

@keyframes modalPop {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.modal-body {
  padding: var(--space-5);
}

.modal-footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  flex-wrap: wrap;
}
