/* Department AI agent section: data-driven visual system. */
.department-ai-card {
  background:
    radial-gradient(circle at 18% 18%, rgba(16, 191, 178, 0.12), transparent 30%),
    radial-gradient(circle at 82% 12%, rgba(31, 122, 224, 0.10), transparent 34%),
    linear-gradient(135deg, #f5fcfa 0%, #ffffff 62%);
}

.department-ai-grid {
  grid-template-columns: minmax(200px, 0.22fr) minmax(390px, 0.43fr) minmax(310px, 0.35fr);
}

.department-visual {
  background:
    radial-gradient(circle at 24% 22%, color-mix(in srgb, var(--agent-accent, #10bfb2) 14%, transparent), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(248, 253, 252, 0.72));
  min-height: 510px;
}

.department-visual::before,
.department-visual::after {
  display: none;
}

.department-content__cta {
  display: none;
}

.department-content {
  min-height: 510px;
}

.department-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric-card {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--agent-accent, #10bfb2) 8%, #ffffff), #ffffff);
  border-color: color-mix(in srgb, var(--agent-accent, #10bfb2) 28%, transparent);
}

.department-ai-section[data-active-department="it"],
.department-ai-section[data-active-department="finance"] {
  --agent-accent: #10bfb2;
  --agent-accent-2: #1f7ae0;
}

.department-ai-section[data-active-department="finance"] {
  --agent-accent-2: #f2b84b;
}

.department-ai-section[data-active-department="hr"] {
  --agent-accent: #25b8a6;
  --agent-accent-2: #9b7cf6;
}

.department-ai-section[data-active-department="procurement"] {
  --agent-accent: #0e9f8f;
  --agent-accent-2: #d58a22;
}

.department-ai-section[data-active-department="sales"] {
  --agent-accent: #1f7ae0;
  --agent-accent-2: #10bfb2;
}

.department-ai-section[data-active-department="operations"] {
  --agent-accent: #14a88f;
  --agent-accent-2: #5867dd;
}

.department-ai-section[data-active-department="service"] {
  --agent-accent: #10bfb2;
  --agent-accent-2: #ec6f64;
}

.department-ai-section[data-active-department="compliance"] {
  --agent-accent: #0e7a72;
  --agent-accent-2: #f2b84b;
}

.agent-diagram {
  color: #102b32;
  display: grid;
  gap: 16px;
  height: 100%;
  min-height: 454px;
  position: relative;
}

.agent-diagram::before {
  background-image:
    linear-gradient(color-mix(in srgb, var(--agent-accent) 12%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--agent-accent) 12%, transparent) 1px, transparent 1px);
  background-size: 28px 28px;
  border-radius: 18px;
  content: "";
  inset: 0;
  opacity: 0.32;
  pointer-events: none;
  position: absolute;
}

.agent-diagram__header,
.agent-diagram__footer,
.agent-node,
.agent-pill,
.agent-hub,
.agent-panel {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(7, 28, 34, 0.08);
  box-shadow: 0 26px 56px -42px rgba(7, 28, 34, 0.48);
  position: relative;
  z-index: 1;
}

.agent-diagram__header,
.agent-diagram__footer {
  align-items: center;
  border-radius: 14px;
  display: flex;
  justify-content: space-between;
  min-height: 48px;
  padding: 12px 14px;
}

.agent-diagram__header span,
.agent-diagram__footer span,
.agent-node small,
.agent-pill small {
  color: #63787d;
  font-size: 0.72rem;
  font-weight: 720;
}

.agent-diagram__header strong {
  background: color-mix(in srgb, var(--agent-accent) 13%, #ffffff);
  border: 1px solid color-mix(in srgb, var(--agent-accent) 28%, transparent);
  border-radius: 999px;
  color: color-mix(in srgb, var(--agent-accent) 72%, #071c22);
  font-size: 14px;
  padding: 5px 10px;
}

.agent-diagram__footer {
  align-self: end;
  color: #395259;
  gap: 10px;
}

.agent-diagram__footer span {
  color: #395259;
}

.agent-node,
.agent-pill,
.agent-panel {
  border-radius: 16px;
  padding: 14px;
}

.agent-node strong,
.agent-pill strong,
.agent-panel strong {
  color: #071c22;
  display: block;
  font-size: 0.92rem;
  line-height: 1.15;
}

.agent-node small,
.agent-pill small,
.agent-panel small {
  display: block;
  line-height: 1.25;
  margin-top: 6px;
}

.agent-icon {
  align-items: center;
  background: linear-gradient(135deg, var(--agent-accent), var(--agent-accent-2));
  border-radius: 12px;
  color: #ffffff;
  display: inline-flex;
  font-size: 0.74rem;
  font-weight: 900;
  height: 32px;
  justify-content: center;
  margin-bottom: 10px;
  width: 32px;
}

.agent-flow-line {
  background: linear-gradient(90deg, transparent, var(--agent-accent), transparent);
  height: 2px;
  opacity: 0.5;
  position: relative;
  z-index: 1;
}

.agent-command-map {
  align-content: center;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  position: relative;
  z-index: 1;
}

.agent-command-map span {
  align-items: center;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid color-mix(in srgb, var(--agent-accent) 20%, rgba(7, 28, 34, 0.08));
  border-radius: 16px;
  color: #17343b;
  display: flex;
  font-size: 14px;
  font-weight: 760;
  justify-content: center;
  min-height: 96px;
  padding: 14px;
  text-align: center;
}

.agent-diagram--command .agent-command-map span:nth-child(2),
.agent-diagram--flow .agent-flow-step:nth-child(3),
.agent-diagram--journey .agent-journey-step:nth-child(3),
.agent-diagram--pipeline .agent-pipeline-card:nth-child(3),
.agent-diagram--cockpit .agent-cockpit-main,
.agent-diagram--tower .agent-tower-center,
.agent-diagram--hub .agent-hub,
.agent-diagram--shield .agent-shield-core {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--agent-accent) 14%, #ffffff), #ffffff);
  border-color: color-mix(in srgb, var(--agent-accent) 40%, transparent);
}

.agent-flow {
  display: grid;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.agent-flow-step {
  align-items: center;
  border-radius: 16px;
  display: grid;
  gap: 12px;
  grid-template-columns: 36px 1fr auto;
  min-height: 62px;
  padding: 12px 14px;
}

.agent-flow-step em {
  background: color-mix(in srgb, var(--agent-accent) 16%, #ffffff);
  border-radius: 999px;
  color: color-mix(in srgb, var(--agent-accent) 72%, #071c22);
  font-style: normal;
  font-weight: 850;
  height: 30px;
  text-align: center;
  width: 30px;
}

.agent-flow-step span:last-child {
  color: #6e858a;
  font-size: 0.72rem;
  font-weight: 720;
}

.agent-journey {
  align-content: center;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  position: relative;
  z-index: 1;
}

.agent-journey-step {
  min-height: 122px;
}

.agent-journey-step:nth-child(2),
.agent-journey-step:nth-child(5) {
  transform: translateY(18px);
}

.agent-pipeline {
  display: grid;
  gap: 14px;
  grid-template-columns: 0.9fr 1.1fr;
  position: relative;
  z-index: 1;
}

.agent-pipeline-rail {
  background: linear-gradient(180deg, var(--agent-accent), var(--agent-accent-2));
  border-radius: 999px;
  grid-row: span 3;
  justify-self: center;
  opacity: 0.76;
  width: 8px;
}

.agent-pipeline-card {
  min-height: 94px;
}

.agent-cockpit {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr 1.1fr;
  position: relative;
  z-index: 1;
}

.agent-cockpit-main {
  align-content: center;
  display: grid;
  grid-row: span 2;
  min-height: 210px;
}

.agent-cockpit-gauge {
  background:
    conic-gradient(from -90deg, var(--agent-accent) 0 68%, rgba(7, 28, 34, 0.08) 68% 100%);
  border-radius: 999px;
  height: 92px;
  margin-bottom: 14px;
  width: 92px;
}

.agent-tower {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  position: relative;
  z-index: 1;
}

.agent-tower-center {
  align-content: center;
  grid-column: 1 / -1;
  min-height: 150px;
}

.agent-tower-center::before {
  background: linear-gradient(90deg, var(--agent-accent), var(--agent-accent-2));
  border-radius: 999px;
  content: "";
  display: block;
  height: 8px;
  margin-bottom: 18px;
  width: 72%;
}

.agent-hub-layout {
  align-items: center;
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr 1.2fr 1fr;
  position: relative;
  z-index: 1;
}

.agent-hub {
  align-content: center;
  border-radius: 999px;
  display: grid;
  height: 180px;
  justify-items: center;
  text-align: center;
}

.agent-hub::before {
  background: radial-gradient(circle, var(--agent-accent), var(--agent-accent-2));
  border-radius: 999px;
  content: "";
  height: 62px;
  margin-bottom: 10px;
  width: 62px;
}

.agent-hub-side {
  display: grid;
  gap: 12px;
}

.agent-shield {
  align-items: center;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  position: relative;
  z-index: 1;
}

.agent-shield-core {
  align-content: center;
  border-radius: 28px;
  display: grid;
  grid-row: span 2;
  min-height: 220px;
}

.agent-shield-core::before {
  background:
    linear-gradient(135deg, var(--agent-accent), var(--agent-accent-2));
  border-radius: 32px 32px 44px 44px;
  content: "";
  height: 90px;
  margin-bottom: 16px;
  width: 78px;
}

.agent-diagram.is-entering .agent-node,
.agent-diagram.is-entering .agent-pill,
.agent-diagram.is-entering .agent-panel,
.agent-diagram.is-entering .agent-command-map span {
  animation: agentCardIn 320ms ease both;
}

.agent-diagram.is-entering .agent-node:nth-child(2),
.agent-diagram.is-entering .agent-pill:nth-child(2),
.agent-diagram.is-entering .agent-panel:nth-child(2),
.agent-diagram.is-entering .agent-command-map span:nth-child(2) {
  animation-delay: 45ms;
}

.agent-diagram.is-entering .agent-node:nth-child(3),
.agent-diagram.is-entering .agent-pill:nth-child(3),
.agent-diagram.is-entering .agent-panel:nth-child(3),
.agent-diagram.is-entering .agent-command-map span:nth-child(3) {
  animation-delay: 90ms;
}

@keyframes agentCardIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 1180px) {
  .department-ai-grid {
    grid-template-columns: 1fr;
  }

  .department-tabs {
    -webkit-overflow-scrolling: touch;
    overflow-x: auto;
    padding-bottom: 10px;
    position: relative;
    scroll-snap-type: x proximity;
  }

  .department-tabs::after {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.96));
    content: "Swipe →";
    color: #0e7a72;
    font-size: 14px;
    font-weight: 760;
    line-height: 1;
    padding: 18px 4px 0 36px;
    pointer-events: none;
    position: sticky;
    right: 0;
    text-align: right;
  }

  .department-ai-section.has-tab-interacted .department-tabs::after {
    display: none;
  }

  .department-tab {
    min-height: 44px;
    scroll-snap-align: start;
  }

  .department-tab__icon,
  .agent-diagram__header span,
  .agent-diagram__header strong,
  .agent-diagram__footer span,
  .agent-command-map span,
  .agent-node small,
  .agent-pill small,
  .agent-panel small,
  .agent-flow-step span:last-child {
    font-size: 14px;
  }

  .department-visual,
  .department-content {
    min-height: auto;
  }
}

@media (max-width: 640px) {
  .department-visual {
    padding: 16px;
  }

  .agent-diagram {
    gap: 12px;
    min-height: 0;
  }

  .agent-command-map,
  .agent-journey,
  .agent-tower,
  .agent-shield,
  .agent-cockpit,
  .agent-pipeline,
  .agent-hub-layout {
    grid-template-columns: 1fr;
  }

  .agent-command-map span,
  .agent-journey-step,
  .agent-pipeline-card,
  .agent-tower-center,
  .agent-hub,
  .agent-shield-core {
    min-height: 88px;
  }

  .agent-flow-step {
    grid-template-columns: 30px 1fr;
  }

  .agent-flow-step span:last-child {
    grid-column: 2;
  }

  .agent-journey-step:nth-child(2),
  .agent-journey-step:nth-child(5) {
    transform: none;
  }

  .agent-pipeline-rail {
    display: none;
  }

  .agent-hub {
    border-radius: 18px;
    height: auto;
    min-height: 120px;
  }

  .department-metrics {
    grid-template-columns: 1fr;
  }
}
