/* Option D — one contact hub. Replaces the two corner FABs. */

.hub-dock {
  position: relative;
  width: max-content;
  max-width: 100%;
  margin-left: auto;
  pointer-events: none;
}

.hub-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 12px);
  z-index: 2;
  width: min(340px, calc(100vw - 2.5rem));
  padding: 8px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(180%) blur(22px);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  border: 1px solid rgba(255, 255, 255, 0.92);
  box-shadow:
    0 18px 50px rgba(29, 29, 31, 0.14),
    0 2px 8px rgba(29, 29, 31, 0.05);
  transform-origin: bottom right;
  pointer-events: auto;
}

.hub-menu[hidden] {
  display: none !important;
}

.hub-menu.is-open {
  animation: hub-in 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes hub-in {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

.hub-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 10px 12px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
}

.hub-row + .hub-row {
  margin-top: 2px;
}

.hub-row:hover,
.hub-row:focus-visible {
  background: rgba(245, 245, 247, 0.95);
  outline: none;
}

.hub-row:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(196, 92, 92, 0.45);
}

.hub-avatar {
  position: relative;
  width: 44px;
  height: 44px;
  flex: none;
}

.hub-avatar-sm {
  width: 40px;
  height: 40px;
}

.hub-avatar-photo {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  background: #f2f2f4;
}

/* mahmoud-montaser.png is a tall portrait. Zoom to the face (about 30% down). */
.hub-avatar-photo img {
  position: absolute;
  width: 240%;
  height: auto;
  max-width: none;
  left: 50%;
  top: -58%;
  transform: translateX(-50%);
  border-radius: 0;
}

.hub-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #30d158;
  border: 2px solid #fff;
  box-sizing: border-box;
}

.hub-ico {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  background: #f3f3f5;
  color: #1d1d1f;
}

.hub-ico svg {
  display: block;
  width: 22px;
  height: 22px;
}

.hub-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.hub-title {
  color: #1d1d1f;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.hub-title.is-rose {
  color: #c45c5c;
}

.hub-sub {
  color: #8e8e93;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.hub-pill {
  margin-left: auto;
  flex: none;
  border-radius: 999px;
  background: #c45c5c;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
  padding: 6px 10px;
}

.hub-pill[hidden] {
  display: none !important;
}

.hub-fab {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin-left: auto;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #c45c5c;
  color: #fff;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 12px 32px rgba(196, 92, 92, 0.38);
  transition: background 0.2s ease, transform 0.15s ease;
}

.hub-fab:hover {
  background: #b85050;
}

.hub-fab:active {
  transform: scale(0.96);
}

.hub-fab:focus-visible {
  outline: 3px solid #a84848;
  outline-offset: 3px;
}

.hub-fab svg {
  display: block;
  width: 26px;
  height: 26px;
}

.hub-fab .hub-x {
  display: none;
}

.hub-fab.is-open .hub-chat {
  display: none;
}

.hub-fab.is-open .hub-x {
  display: block;
}

.hub-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: #1d1d1f;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  box-sizing: border-box;
  pointer-events: none;
}

.hub-count[hidden] {
  display: none !important;
}

.fab-stack.fab-hidden .hub-fab,
.fab-stack.fab-hidden .hub-menu,
.fab-stack.fab-hidden .hub-row {
  pointer-events: none !important;
}

/* Chat header uses the same rose avatar treatment on every page. */
.chat-modal .hub-title {
  margin: 0;
  font-size: 14px;
}

.chat-modal .amt-chat-sub {
  margin: 0;
  color: #86868b;
  font-size: 11px;
  line-height: 1.3;
}

/* Pages without Tailwind (georgia) still get a glass chat panel. */
.hub-root {
  position: fixed;
  z-index: 70;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 16px;
  padding-bottom: max(1.25rem, calc(env(safe-area-inset-bottom) + 0.75rem));
  pointer-events: none;
}

@media (min-width: 640px) {
  .hub-root {
    padding: 20px;
    padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
  }
}

.hub-root .chat-modal {
  width: min(100vw - 2rem, 380px);
  margin: 0 0 12px auto;
  overflow: hidden;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: saturate(180%) blur(28px);
  -webkit-backdrop-filter: saturate(180%) blur(28px);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: 0 18px 50px rgba(29, 29, 31, 0.12);
  pointer-events: auto;
}

.amt-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.4);
}

.amt-chat-id {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.hub-chat-x {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex: none;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #6e6e73;
  cursor: pointer;
}

.hub-chat-x:hover {
  background: #fff;
}

.hub-root #chatMessages {
  box-sizing: border-box;
  height: 18rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.28);
}

.hub-root .bubble-user,
.hub-root .bubble-ai {
  max-width: 88%;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.45;
}

.hub-root .bubble-user {
  margin-left: auto;
  background: #c45c5c;
  color: #fff;
  border-radius: 1.15rem 1.15rem 0.3rem 1.15rem;
}

.hub-root .bubble-ai {
  background: rgba(245, 245, 247, 0.82);
  color: #1d1d1f;
  border-radius: 1.15rem 1.15rem 1.15rem 0.3rem;
  border: 1px solid rgba(255, 255, 255, 0.55);
}

.hub-root #chatForm {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.4);
}

.hub-root #chatInput {
  flex: 1;
  min-width: 0;
  border-radius: 999px;
  border: 1px solid #e5e5ea;
  background: #fff;
  padding: 10px 16px;
  font: inherit;
  font-size: 16px;
  color: #1d1d1f;
  outline: none;
}

.hub-root #chatInput:focus {
  border-color: #c45c5c;
  box-shadow: 0 0 0 4px rgba(196, 92, 92, 0.12);
}

.hub-send {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: none;
  border: 0;
  border-radius: 999px;
  background: #c45c5c;
  color: #fff;
  cursor: pointer;
}

.hub-send:hover {
  background: #a84848;
}

.chat-modal.hub-gated #chatForm {
  display: none !important;
}

.hub-signup {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 12px 14px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.86);
}

.hub-signup[hidden] {
  display: none !important;
}

.hub-signup-title {
  margin: 0;
  color: #c45c5c;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.hub-signup-sub {
  margin: 0 0 2px;
  color: #6e6e73;
  font-size: 13px;
  line-height: 1.35;
}

.hub-signup-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: #1d1d1f;
  font-size: 12px;
  font-weight: 600;
}

.hub-signup input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #e5e5ea;
  border-radius: 999px;
  background: #fff;
  color: #1d1d1f;
  font: inherit;
  font-size: 16px;
  font-weight: 450;
  padding: 10px 14px;
  outline: none;
}

.hub-signup input:focus {
  border-color: #c45c5c;
  box-shadow: 0 0 0 4px rgba(196, 92, 92, 0.12);
}

.hub-signup button {
  border: 0;
  border-radius: 999px;
  background: #c45c5c;
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  padding: 11px 14px;
  cursor: pointer;
}

.hub-signup button:hover {
  background: #a84848;
}

.hub-signup button:disabled {
  opacity: 0.6;
  cursor: default;
}

.hub-signup-status {
  min-height: 1em;
  margin: 0;
  color: #a84848;
  font-size: 12px;
  line-height: 1.3;
}

.hub-root .chat-modal {
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.96);
  transition:
    opacity 0.28s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0.28s;
}

.hub-root .chat-modal.open {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.hub-tabs {
  display: flex;
  gap: 6px;
  padding: 8px 10px 0;
}

.hub-tab {
  flex: 1;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #6e6e73;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: -0.01em;
  padding: 8px 10px;
  cursor: pointer;
}

.hub-tab[aria-selected="true"] {
  background: #c45c5c;
  color: #fff;
}

.hub-pane[hidden] {
  display: none !important;
}

.dm-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.1rem;
  height: 1.1rem;
  margin-left: 4px;
  padding: 0 4px;
  border-radius: 999px;
  background: #c45c5c;
  color: #fff;
  font-size: 10px;
  line-height: 1;
  vertical-align: 1px;
}

.hub-tab[aria-selected="true"] .dm-tab-badge {
  background: #fff;
  color: #c45c5c;
}

.dm-tab-badge[hidden] {
  display: none !important;
}

#chatModal.is-dm {
  background: rgba(22, 14, 16, 0.78);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  color: #f6f1f1;
  backdrop-filter: saturate(160%) blur(28px);
  -webkit-backdrop-filter: saturate(160%) blur(28px);
}

#chatModal.is-dm > :first-child {
  background: transparent !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: #f6f1f1;
}

#chatModal.is-dm .hub-chat-x,
#chatModal.is-dm #chatClose {
  color: #f6f1f1;
}

#chatModal.is-dm .amt-chat-sub {
  color: rgba(246, 241, 241, 0.68);
}

#chatModal.is-dm .hub-tab {
  color: rgba(246, 241, 241, 0.72);
}

#chatModal.is-dm .hub-tab[aria-selected="true"] {
  background: #c45c5c;
  color: #fff;
}

.dm-log {
  box-sizing: border-box;
  height: 16.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 14px 8px;
}

.dm-empty {
  margin: 0;
  color: rgba(246, 241, 241, 0.72);
  font-size: 13px;
  line-height: 1.45;
}

.dm-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  max-width: 100%;
}

.dm-row.is-mine {
  align-items: flex-end;
}

.dm-bubble {
  max-width: 88%;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.dm-meta {
  margin: 0;
  color: rgba(246, 241, 241, 0.5);
  font-size: 11px;
  line-height: 1.2;
}

.dm-bubble.is-failed {
  outline: 1px solid rgba(196, 92, 92, 0.85);
}

.dm-mine {
  margin-left: auto;
  background: #c45c5c;
  color: #fff;
  border-radius: 1.15rem 1.15rem 0.3rem 1.15rem;
}

.dm-mine.is-pending {
  opacity: 0.72;
}

.dm-theirs {
  background: rgba(255, 255, 255, 0.12);
  color: #f6f1f1;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 1.15rem 1.15rem 1.15rem 0.3rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.dm-note {
  margin: 0;
  padding: 0 14px 4px;
  color: rgba(246, 241, 241, 0.55);
  font-size: 11px;
  line-height: 1.35;
}

.dm-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.dm-form input {
  flex: 1;
  min-width: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  padding: 10px 16px;
  font: inherit;
  font-size: 16px;
  outline: none;
}

.dm-form input::placeholder {
  color: rgba(246, 241, 241, 0.45);
}

.dm-form input:focus {
  border-color: #c45c5c;
  box-shadow: 0 0 0 4px rgba(196, 92, 92, 0.28);
}

.dm-toast {
  position: fixed;
  right: 16px;
  bottom: 96px;
  z-index: 90;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(22, 14, 16, 0.9);
  color: #fff;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 999px;
  padding: 10px 16px;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
}

.dm-toast[hidden] {
  display: none !important;
}

.fab-stack:has(#chatModal.open) .dm-toast {
  top: 16px;
  bottom: auto;
}

@media (prefers-reduced-motion: reduce) {
  .hub-menu.is-open,
  .hub-fab,
  .hub-root .chat-modal {
    animation: none;
    transition: none;
  }
}
