.iv-directory {
  --iv-accent: #25D366;
  --iv-bg: #ffffff;
  --iv-fg: #1a1a1a;
  --iv-fg-muted: #6b7280;
  --iv-border: rgba(0, 0, 0, 0.08);
  --iv-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
  --iv-panel-bg: #ffffff;
  --iv-overlay-bg: rgba(255, 255, 255, 0.97);
  --iv-channel-bg: #f4f5f7;
  --iv-channel-bg-hover: #ebedf0;

  position: fixed;
  bottom: 20px;
  z-index: 2147483000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  color: var(--iv-fg);
  box-sizing: border-box;
}

.iv-directory *,
.iv-directory *::before,
.iv-directory *::after {
  box-sizing: inherit;
}

.iv-directory--bottom-right { right: 20px; }
.iv-directory--bottom-left { left: 20px; }

@media (prefers-color-scheme: dark) {
  .iv-directory:not([data-iv-theme="light"]) {
    --iv-bg: #1f2430;
    --iv-fg: #f3f4f6;
    --iv-fg-muted: #9aa1ac;
    --iv-border: rgba(255, 255, 255, 0.12);
    --iv-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
    --iv-panel-bg: #262c3a;
    --iv-overlay-bg: rgba(38, 44, 58, 0.97);
    --iv-channel-bg: #313848;
    --iv-channel-bg-hover: #3a4256;
  }
}

.iv-directory[data-iv-theme="dark"] {
  --iv-bg: #1f2430;
  --iv-fg: #f3f4f6;
  --iv-fg-muted: #9aa1ac;
  --iv-border: rgba(255, 255, 255, 0.12);
  --iv-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  --iv-panel-bg: #262c3a;
  --iv-overlay-bg: rgba(38, 44, 58, 0.97);
  --iv-channel-bg: #313848;
  --iv-channel-bg-hover: #3a4256;
}

.iv-directory-fab-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.iv-directory--bottom-left .iv-directory-fab-wrap {
  align-items: flex-start;
}

.iv-directory-fab {
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  background: var(--iv-accent);
  color: #fff;
  box-shadow: var(--iv-shadow);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: transform 0.15s ease;
}

.iv-directory-fab:hover { transform: scale(1.05); }
.iv-directory-fab:active { transform: scale(0.97); }

.iv-directory-fab svg {
  width: 26px;
  height: 26px;
  fill: currentColor;
}

.iv-directory-fab-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid var(--iv-bg);
}

.iv-directory-fab-dot--offline { background: #9ca3af; }

.iv-directory-panel {
  width: 320px;
  max-width: calc(100vw - 40px);
  max-height: 70vh;
  overflow-y: auto;
  background: var(--iv-panel-bg);
  border-radius: 16px;
  box-shadow: var(--iv-shadow);
  border: 1px solid var(--iv-border);
}

.iv-directory-panel-header {
  padding: 16px 18px;
  background: var(--iv-accent);
  color: #fff;
  border-radius: 16px 16px 0 0;
  font-weight: 600;
}

.iv-directory-panel-body {
  padding: 8px;
}

.iv-directory-agent {
  padding: 10px 10px;
  border-radius: 12px;
}

.iv-directory-agent + .iv-directory-agent {
  margin-top: 4px;
  border-top: 1px solid var(--iv-border);
  padding-top: 14px;
}

.iv-directory-agent-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.iv-directory-agent-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--iv-channel-bg);
  flex-shrink: 0;
}

.iv-directory-agent-avatar-fallback {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--iv-channel-bg);
  color: var(--iv-fg-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  flex-shrink: 0;
}

.iv-directory-agent-name {
  font-weight: 600;
  color: var(--iv-fg);
}

.iv-directory-agent-status {
  font-size: 12px;
  color: var(--iv-fg-muted);
}

.iv-directory-agent-status--offline { color: #b45309; }

.iv-directory-channels {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.iv-directory-channel {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--iv-channel-bg);
  color: var(--iv-fg);
  text-decoration: none;
  font-size: 13px;
  transition: background 0.15s ease;
}

.iv-directory-channel:hover { background: var(--iv-channel-bg-hover); }

.iv-directory-channel-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.iv-directory-channel-icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.iv-directory-channel--whatsapp .iv-directory-channel-icon { color: #25D366; }
.iv-directory-channel--telegram .iv-directory-channel-icon { color: #29a9eb; }
.iv-directory-channel--messenger .iv-directory-channel-icon { color: #8b5cf6; }
.iv-directory-channel--instagram .iv-directory-channel-icon { color: #d6249f; }
.iv-directory-channel--phone .iv-directory-channel-icon { color: #6b7280; }
.iv-directory-channel--email .iv-directory-channel-icon { color: #6b7280; }
.iv-directory-channel--x .iv-directory-channel-icon { color: #111111; }

@media (prefers-color-scheme: dark) {
  .iv-directory:not([data-iv-theme="light"]) .iv-directory-channel--x .iv-directory-channel-icon { color: #f3f4f6; }
}
.iv-directory[data-iv-theme="dark"] .iv-directory-channel--x .iv-directory-channel-icon { color: #f3f4f6; }

.iv-directory-consent {
  padding: 16px 18px;
}

.iv-directory-consent-text {
  color: var(--iv-fg);
  margin-bottom: 14px;
}

.iv-directory-consent-actions {
  display: flex;
  justify-content: flex-end;
}

.iv-directory-consent-accept {
  border: none;
  background: var(--iv-accent);
  color: #fff;
  padding: 9px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}

.iv-directory-consent-accept:hover { filter: brightness(1.05); }

.iv-directory-attribution {
  display: block;
  text-align: center;
  font-size: 11px;
  color: var(--iv-fg-muted);
  text-decoration: none;
  padding: 4px 2px;
}

.iv-directory-attribution:hover { color: var(--iv-fg); }

.iv-directory-attribution-standalone {
  margin-top: 6px;
}

.iv-directory-hidden { display: none !important; }
