/* Casan agentic — floating UI cluster (axis-aligned cards) */
.casan-agentic {
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 280px;
  overflow: hidden;
  border-radius: 0;
  background: transparent;
  isolation: isolate;
}

.casan-agentic__stage {
  position: absolute;
  inset: 0;
  z-index: 2;
  padding: 0;
  pointer-events: none;
}

/* Soft ambient glow behind the cluster — not a plate */
.casan-agentic__glow {
  position: absolute;
  width: 62%;
  height: 52%;
  left: 48%;
  top: 40%;
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 128, 96, 0.28) 0%, transparent 70%);
  filter: blur(8px);
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.8s var(--ease), transform 0.9s var(--ease);
  pointer-events: none;
  z-index: 0;
}

.casan-agentic.is-ready .casan-agentic__glow {
  opacity: 1;
  transform: scale(1);
}

/* Shared floating chrome */
.casan-agentic__bubble,
.casan-agentic__card,
.casan-agentic__task,
.casan-agentic__draft,
.casan-agentic__note {
  position: absolute;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.16),
    0 22px 44px -18px rgba(0, 0, 0, 0.55),
    0 10px 18px -12px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.5s var(--ease),
    transform 0.6s var(--ease);
}

/* Tenant inbound bubble — upper-left into the mid panel */
.casan-agentic__bubble {
  --rot: 0deg;
  z-index: 4;
  top: 4%;
  left: 1%;
  width: min(58%, 248px);
  border-radius: 1rem 1rem 0.35rem 1rem;
  background: rgba(255, 255, 255, 0.97);
  color: #111;
  padding: 0.7rem 0.85rem;
  font-size: 0.74rem;
  line-height: 1.35;
  transform: rotate(var(--rot)) scale(0.96) translateY(12px);
}

.casan-agentic__bubble.is-on {
  opacity: 1;
  transform: rotate(var(--rot)) scale(1) translateY(0);
}

.casan-agentic__bubble.is-float {
  animation: casan-agentic-float 6.2s ease-in-out infinite;
}

.casan-agentic__bubble small {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.6rem;
  color: #6b6b6b;
}

/* AI draft reply — upper mid/right, offsets the column */
.casan-agentic__draft {
  --rot: 0deg;
  z-index: 3;
  top: 8%;
  left: 46%;
  width: min(48%, 210px);
  border-radius: 0.9rem;
  background: #fff;
  color: #111;
  padding: 0.65rem 0.75rem;
  font-size: 0.68rem;
  line-height: 1.35;
  transform: rotate(var(--rot)) scale(0.96) translateY(10px);
}

.casan-agentic__draft.is-on {
  opacity: 1;
  transform: rotate(var(--rot)) scale(1) translateY(0);
}

.casan-agentic__draft.is-float {
  animation: casan-agentic-float 7s ease-in-out 0.4s infinite;
}

.casan-agentic__draft-label {
  display: block;
  margin-bottom: 0.28rem;
  font-size: 0.58rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: #0b5c3f;
  text-transform: uppercase;
}

.casan-agentic__draft p {
  margin: 0;
  color: #222;
}

/* Main unit card — mid-right, slightly lower (no tilt) */
.casan-agentic__card {
  --rot: 0deg;
  z-index: 5;
  top: 30%;
  left: 28%;
  width: min(66%, 280px);
  border-radius: 1.05rem;
  background: #fff;
  color: #0a0a0a;
  padding: 1rem 1.05rem 1.1rem;
  transform: rotate(var(--rot)) scale(0.96) translateY(14px);
  transition:
    opacity 0.55s var(--ease),
    transform 0.7s var(--ease),
    box-shadow 0.4s ease;
}

.casan-agentic__card.is-in {
  opacity: 1;
  transform: rotate(var(--rot)) scale(1) translateY(0);
}

.casan-agentic__card.is-float {
  animation: casan-agentic-float 5.5s ease-in-out infinite;
}

.casan-agentic__card.is-focus {
  box-shadow:
    0 0 0 1px rgba(149, 191, 71, 0.35),
    0 0 32px rgba(0, 128, 96, 0.25),
    0 28px 56px -22px rgba(0, 0, 0, 0.65);
}

.casan-agentic__card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.casan-agentic__home {
  display: flex;
  height: 2.25rem;
  width: 2.25rem;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: 0.7rem;
  background: #002e25;
  color: #95bf47;
}

.casan-agentic__home svg {
  width: 1.15rem;
  height: 1.15rem;
}

.casan-agentic__addr {
  min-width: 0;
  flex: 1;
}

.casan-agentic__addr strong {
  display: block;
  font-size: 0.92rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.casan-agentic__addr span {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.72rem;
  color: #5c5c5c;
}

.casan-agentic__chip {
  flex-shrink: 0;
  border-radius: 999px;
  background: #e8f5e9;
  color: #0b5c3f;
  font-size: 0.65rem;
  font-weight: 650;
  padding: 0.28rem 0.55rem;
  white-space: nowrap;
  opacity: 0;
  transform: scale(0.85);
  transition:
    opacity 0.35s var(--ease),
    transform 0.4s var(--ease);
}

.casan-agentic__card.is-chip .casan-agentic__chip {
  opacity: 1;
  transform: scale(1);
}

.casan-agentic__meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  margin-top: 0.85rem;
}

.casan-agentic__meta div {
  border-radius: 0.65rem;
  background: #f4f3f0;
  padding: 0.45rem 0.55rem;
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 0.4s var(--ease),
    transform 0.4s var(--ease);
}

.casan-agentic__card.is-detail .casan-agentic__meta div {
  opacity: 1;
  transform: translateY(0);
}

.casan-agentic__card.is-detail .casan-agentic__meta div:nth-child(2) {
  transition-delay: 0.1s;
}

.casan-agentic__meta dt {
  font-size: 0.62rem;
  color: #6b6b6b;
  margin: 0;
}

.casan-agentic__meta dd {
  margin: 0.1rem 0 0;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* Task chip — lower-left of the cluster */
.casan-agentic__task {
  --rot: 0deg;
  z-index: 4;
  top: 62%;
  left: 2%;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: fit-content;
  max-width: min(56%, 220px);
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.96);
  color: #111;
  padding: 0.45rem 0.65rem;
  font-size: 0.68rem;
  font-weight: 600;
  transform: rotate(var(--rot)) scale(0.96) translateY(8px);
}

.casan-agentic__task.is-on {
  opacity: 1;
  transform: rotate(var(--rot)) scale(1) translateY(0);
}

.casan-agentic__task.is-float {
  animation: casan-agentic-float 6.8s ease-in-out 0.2s infinite;
}

.casan-agentic__task-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  background: #e6a317;
  flex-shrink: 0;
}

/* Flyttesyn note — mid-right, fills horizontal gap */
.casan-agentic__note {
  --rot: 0deg;
  z-index: 3;
  top: 54%;
  left: 52%;
  width: min(44%, 196px);
  border-radius: 0.85rem;
  background: #fff;
  color: #111;
  padding: 0.55rem 0.7rem;
  font-size: 0.66rem;
  line-height: 1.3;
  font-weight: 600;
  transform: rotate(var(--rot)) scale(0.96) translateY(8px);
}

.casan-agentic__note.is-on {
  opacity: 1;
  transform: rotate(var(--rot)) scale(1) translateY(0);
}

.casan-agentic__note.is-float {
  animation: casan-agentic-float 7.4s ease-in-out 0.55s infinite;
}

.casan-agentic__note small {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.58rem;
  font-weight: 500;
  color: #6b6b6b;
}

.casan-agentic__suggest {
  position: absolute;
  z-index: 3;
  left: 38%;
  bottom: 20%;
  translate: -50% 0;
  display: flex;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transform: translateY(10px) scale(0.96);
  transition:
    opacity 0.45s var(--ease),
    transform 0.5s var(--ease);
  width: auto;
}

.casan-agentic__suggest.is-on {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.casan-agentic__suggest-pill {
  border-radius: 999px;
  background: rgba(0, 46, 37, 0.94);
  color: #d7f0c4;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  padding: 0.35rem 0.7rem;
  box-shadow: 0 8px 20px -10px rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(149, 191, 71, 0.35);
}

.casan-agentic__composer {
  position: absolute;
  z-index: 4;
  left: 42%;
  bottom: 5%;
  translate: -50% 0;
  width: min(78%, 300px);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  border-radius: 999px;
  background: #fff;
  padding: 0.55rem 0.55rem 0.55rem 1.05rem;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.35),
    0 0 40px 8px rgba(180, 220, 255, 0.32),
    0 18px 40px -16px rgba(0, 0, 0, 0.55);
  transform: translateY(16px) scale(0.96);
  opacity: 0;
  transition:
    opacity 0.5s var(--ease),
    transform 0.6s var(--ease),
    box-shadow 0.4s ease;
}

.casan-agentic__composer.is-on {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.casan-agentic__composer.is-glow {
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.4),
    0 0 48px 12px rgba(149, 191, 71, 0.28),
    0 18px 40px -16px rgba(0, 0, 0, 0.55);
}

.casan-agentic__composer-text {
  flex: 1;
  min-width: 0;
  font-size: 0.82rem;
  line-height: 1.35;
  color: #111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.casan-agentic__composer-text .muted {
  color: #8a8a8a;
}

.casan-agentic__caret {
  display: inline-block;
  width: 1px;
  height: 0.95em;
  margin-left: 1px;
  vertical-align: -0.1em;
  background: #111;
  animation: casan-agentic-blink 1s step-end infinite;
}

.casan-agentic__send {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 999px;
  background: #0a0a0a;
  color: #fff;
  box-shadow: 0 4px 12px -4px rgba(0, 0, 0, 0.45);
  transition: transform 0.22s var(--ease), background 0.22s ease;
}

.casan-agentic__send.is-pulse {
  transform: scale(1.1);
  background: #008060;
}

.casan-agentic__send svg {
  width: 1rem;
  height: 1rem;
}

/* Sent confirmation flash */
.casan-agentic__sent {
  position: absolute;
  z-index: 5;
  left: 42%;
  bottom: 16%;
  translate: -50% 0;
  border-radius: 999px;
  background: #008060;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 650;
  padding: 0.4rem 0.75rem;
  opacity: 0;
  transform: translateY(8px) scale(0.9);
  transition:
    opacity 0.35s var(--ease),
    transform 0.4s var(--ease);
  pointer-events: none;
  white-space: nowrap;
}

.casan-agentic__sent.is-on {
  opacity: 1;
  transform: translateY(0) scale(1);
}

@keyframes casan-agentic-float {
  0%,
  100% {
    transform: rotate(var(--rot, 0deg)) scale(1) translateY(0);
  }
  50% {
    transform: rotate(var(--rot, 0deg)) scale(1) translateY(-6px);
  }
}

@keyframes casan-agentic-blink {
  50% {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .casan-agentic__glow,
  .casan-agentic__card,
  .casan-agentic__bubble,
  .casan-agentic__task,
  .casan-agentic__draft,
  .casan-agentic__note,
  .casan-agentic__suggest,
  .casan-agentic__composer,
  .casan-agentic__meta div,
  .casan-agentic__chip,
  .casan-agentic__sent {
    transition: none !important;
    animation: none !important;
    opacity: 1 !important;
  }
  .casan-agentic__bubble,
  .casan-agentic__card,
  .casan-agentic__task,
  .casan-agentic__draft,
  .casan-agentic__note {
    transform: rotate(var(--rot, 0deg)) !important;
  }
  .casan-agentic__suggest,
  .casan-agentic__composer,
  .casan-agentic__sent {
    transform: none !important;
  }
  .casan-agentic__caret {
    animation: none;
  }
}

@media (max-width: 767px) {
  .casan-agentic__bubble {
    top: 2%;
    left: 2%;
    width: min(72%, 230px);
    font-size: 0.66rem;
  }
  .casan-agentic__draft {
    top: 6%;
    left: 38%;
    width: min(56%, 180px);
    font-size: 0.62rem;
  }
  .casan-agentic__card {
    top: 28%;
    left: 14%;
    width: min(78%, 260px);
  }
  .casan-agentic__task {
    top: 60%;
    left: 2%;
    font-size: 0.62rem;
  }
  .casan-agentic__note {
    top: 52%;
    left: 42%;
    width: min(52%, 170px);
    font-size: 0.6rem;
  }
  .casan-agentic__composer,
  .casan-agentic__suggest,
  .casan-agentic__sent {
    left: 50%;
  }
  .casan-agentic__composer {
    width: min(90%, 300px);
  }
  .casan-agentic__composer-text {
    font-size: 0.75rem;
  }
}
