/* Egytag-native private messaging. All color roles come from Design System V4.
   Chat Live still owns transport and message storage. */
.ec-chat, .ec-chat__launcher, .ec-chat__contact {
  --ec-panel: var(--ds-surface-panel, var(--surface-raised, #fff));
  --ec-sidebar: var(--ds-surface-subtle, var(--surface-soft, #f8fbfd));
  --ec-thread: var(--ds-surface-base, var(--surface-raised, #fff));
  --ec-sunken: var(--ds-surface-sunken, var(--surface-canvas, #f3f7fb));
  --ec-interactive: var(--ds-surface-interactive, var(--surface-muted, #eaf1f7));
  --ec-hover: var(--ds-surface-interactive-hover, var(--accent-soft, #dcecf6));
  --ec-selected: var(--ds-surface-selected, var(--accent-soft, #dcecf6));
  --ec-text: var(--ds-text-strong, var(--text-primary, #15232d));
  --ec-body: var(--ds-text-default, var(--text-secondary, #344958));
  --ec-muted: var(--ds-text-muted, var(--text-muted, #60717c));
  --ec-border: var(--ds-border-default, var(--border-subtle, #d7e2e9));
  --ec-border-strong: var(--ds-border-strong, var(--border-strong, #9fb3c1));
  --ec-accent: var(--ds-action-primary-bg, var(--accent, #176b9b));
  --ec-accent-hover: var(--ds-action-primary-hover, var(--accent-hover, #0f557e));
  --ec-on-accent: var(--ds-action-primary-text, #fff);
  --ec-field: var(--ds-field-bg, var(--surface-raised, #fff));
  --ec-field-border: var(--ds-field-border, var(--border-strong, #9fb3c1));
  --ec-field-text: var(--ds-field-text, var(--text-primary, #15232d));
  --ec-placeholder: var(--ds-field-placeholder, var(--text-muted, #60717c));
  --ec-focus: var(--ds-field-border-focus, var(--accent, #176b9b));
  --ec-success: var(--success-text, #21845a);
  --ec-danger: var(--danger-text, #b64747);
  color: var(--ec-text);
  font-family: var(--font-ui, inherit);
}
.ec-chat, .ec-chat * { box-sizing: border-box; }
.ec-chat__icon {
  display: block;
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ec-chat__icon--large { width: 21px; height: 21px; flex-basis: 21px; }
.ec-chat__launcher {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  min-width: 42px;
  height: 42px;
  margin-inline-end: 8px;
  border: 1px solid color-mix(in srgb, var(--ec-accent) 42%, var(--ec-border));
  border-radius: var(--radius-sm, 9px);
  background: color-mix(in srgb, var(--ec-accent) 10%, var(--ec-panel));
  color: var(--ec-accent);
  cursor: pointer;
  transition: background var(--motion-normal, 160ms), border-color var(--motion-normal, 160ms), transform var(--motion-normal, 160ms);
}
.ec-chat__launcher:hover { transform: translateY(-1px); background: var(--ec-hover); border-color: var(--ec-accent); }
.ec-chat__counter {
  position: absolute;
  top: -7px;
  inset-inline-end: -6px;
  display: grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  padding: 0 4px;
  border-radius: 99px;
  background: var(--ec-accent);
  color: var(--ec-on-accent);
  font: 700 11px/1 system-ui, sans-serif;
}
.ec-chat__counter[hidden], .ec-chat__overlay[hidden], .ec-chat__status[hidden] { display: none !important; }
body.ec-chat-open { overflow: hidden; }
.ec-chat__overlay {
  position: fixed;
  inset: 0;
  z-index: 100050;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  padding: 24px;
  background: var(--ds-surface-overlay, rgb(8 18 25 / .65));
  backdrop-filter: blur(4px);
}
.ec-chat__panel {
  width: min(920px, 100%);
  height: min(740px, 100%);
  margin: auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--ec-border);
  border-radius: var(--radius-lg, 22px);
  background: var(--ec-panel);
  color: var(--ec-text);
  box-shadow: var(--shadow-3, 0 24px 70px rgb(0 0 0 / .35));
  font-family: var(--font-ui, inherit);
  font-size: 16px;
  line-height: 1.65;
  text-align: start;
}
/* Focus is placed on the dialog programmatically; only controls get a visible ring. */
.ec-chat__panel:focus { outline: none; }
.ec-chat__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 17px 24px;
  border-bottom: 1px solid var(--ec-border);
  background: linear-gradient(115deg, var(--ec-panel), color-mix(in srgb, var(--ec-accent) 8%, var(--ec-panel)));
}
.ec-chat__heading { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ec-chat__title-row { display: flex; align-items: center; gap: 9px; }
.ec-chat__title-row > .ec-chat__icon { color: var(--ec-accent); }
.ec-chat__heading strong { font-size: 20px; font-weight: 800; line-height: 1.4; }
.ec-chat__heading span { color: var(--ec-muted); font-size: 12px; }
.ec-chat__close, .ec-chat__back, .ec-chat__reply-cancel {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border: 1px solid var(--ec-border);
  border-radius: 10px;
  background: var(--ec-interactive);
  color: var(--ec-body);
  cursor: pointer;
}
.ec-chat__close:hover, .ec-chat__back:hover, .ec-chat__reply-cancel:hover { background: var(--ec-hover); color: var(--ec-accent); }
.ec-chat__status {
  margin: 0;
  padding: 10px 24px;
  border-bottom: 1px solid var(--ds-info-border, var(--ec-border));
  background: var(--ds-info-bg, var(--ec-selected));
  color: var(--ec-body);
  font-size: 13px;
}
.ec-chat__status[data-kind=error] { background: var(--ds-danger-bg, var(--ec-panel)); color: var(--ec-danger); }
.ec-chat__status[data-kind=success] { background: var(--ds-success-bg, var(--ec-panel)); color: var(--ec-success); }
.ec-chat__body { display: grid; grid-template-columns: minmax(250px, 330px) minmax(0, 1fr); flex: 1; min-height: 0; }
.ec-chat__sidebar {
  min-width: 0;
  overflow: auto;
  border-inline-end: 1px solid var(--ec-border);
  background: var(--ec-sidebar);
  scrollbar-color: var(--ec-border-strong) transparent;
}
.ec-chat__list { padding: 16px 12px; }
.ec-chat__new {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--ec-accent);
  border-radius: 11px;
  background: var(--ec-accent);
  color: var(--ec-on-accent);
  font: inherit;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
}
.ec-chat__new:hover { background: var(--ec-accent-hover); border-color: var(--ec-accent-hover); }
.ec-chat__tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; margin-bottom: 13px; }
.ec-chat__tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; min-width: 0; min-height: 62px; padding: 7px 4px; border: 1px solid var(--ec-border); border-radius: 10px; background: var(--ec-interactive); color: var(--ec-body); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.ec-chat__tab.is-active { background: var(--ec-selected); border-color: var(--ec-accent); color: var(--ec-accent); }
.ec-chat__tab:hover { border-color: var(--ec-accent); }
.ec-chat__lookup { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; padding: 12px; border: 1px solid var(--ec-border); border-radius: 10px; background: var(--ec-panel); }
.ec-chat__lookup label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ec-body); }
.ec-chat__new-form {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--ec-border);
  border-radius: 10px;
  background: var(--ec-panel);
}
.ec-chat__new-form label, .ec-chat__report-form label { display: flex; flex-direction: column; gap: 5px; color: var(--ec-body); font-size: 13px; }
.ec-chat__new-input, .ec-chat__search, .ec-chat__select {
  width: 100%;
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid var(--ec-field-border);
  border-radius: 9px;
  background: var(--ec-field);
  color: var(--ec-field-text);
  font: inherit;
  font-size: 14px;
}
.ec-chat__search-wrap { display: flex; flex-direction: column; gap: 6px; margin: 14px 0 8px; color: var(--ec-body); font-size: 12px; font-weight: 650; }
.ec-chat__search-field { position: relative; display: block; }
.ec-chat__search-field > .ec-chat__icon {
  position: absolute;
  top: 50%;
  inset-inline-start: 12px;
  transform: translateY(-50%);
  color: var(--ec-muted);
  pointer-events: none;
}
.ec-chat__search { padding-inline-start: 39px; font-size: 13px; }
.ec-chat__search::placeholder, .ec-chat__input::placeholder { color: var(--ec-placeholder); }
.ec-chat__search:focus-visible, .ec-chat__new-input:focus-visible, .ec-chat__select:focus-visible {
  outline: 2px solid var(--ec-focus);
  outline-offset: 2px;
}
.ec-chat__filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 12px; }
.ec-chat__filter-unread {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 7px 13px;
  border: 1px solid var(--ec-border);
  border-radius: 999px;
  background: var(--ec-interactive);
  color: var(--ec-body);
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}
.ec-chat__filter-unread:hover, .ec-chat__filter-unread:focus-visible, .ec-chat__filter-unread.is-active {
  border-color: var(--ec-accent);
  background: var(--ec-selected);
  color: var(--ec-accent);
}
.ec-chat__section-title { margin: 10px 8px 13px; color: var(--ec-muted); font-size: 13px; font-weight: 750; letter-spacing: .01em; }
.ec-chat__muted { margin: 8px; padding: 12px; color: var(--ec-muted); font-size: 13px; }
.ec-chat__more-rooms, .ec-chat__older {
  display: block;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid var(--ec-border);
  border-radius: 10px;
  background: var(--ec-interactive);
  color: var(--ec-body);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.ec-chat__more-rooms { display: flex; align-items: center; justify-content: center; gap: 7px; width: calc(100% - 16px); margin: 10px 8px 14px; }
.ec-chat__older { margin: 0 auto 14px; }
.ec-chat__more-rooms:hover, .ec-chat__older:hover { background: var(--ec-hover); border-color: var(--ec-accent); color: var(--ec-text); }
.ec-chat__more-rooms:disabled, .ec-chat__older:disabled { opacity: .65; cursor: wait; }
.ec-chat__conversation {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  text-align: start;
  cursor: pointer;
  transition: background var(--motion-normal, 160ms), border-color var(--motion-normal, 160ms);
}
.ec-chat__conversation:hover, .ec-chat__conversation:focus-visible { background: var(--ec-hover); border-color: var(--ec-border); }
.ec-chat__conversation.is-active {
  background: var(--ec-selected);
  border-color: color-mix(in srgb, var(--ec-accent) 48%, var(--ec-border));
  box-shadow: inset 3px 0 0 var(--ec-accent);
}
.ec-chat[dir=rtl] .ec-chat__conversation.is-active { box-shadow: inset -3px 0 0 var(--ec-accent); }
.ec-chat__avatar {
  display: grid;
  place-items: center;
  flex: 0 0 41px;
  width: 41px;
  height: 41px;
  border: 1px solid color-mix(in srgb, var(--ec-accent) 20%, transparent);
  border-radius: 50%;
  background: color-mix(in srgb, var(--ec-accent) 12%, var(--ec-panel));
  color: var(--ec-accent);
  font-size: 18px;
  font-weight: 800;
}
.ec-chat__conversation-copy { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.ec-chat__conversation-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.ec-chat__conversation-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ec-muted); font-size: 12px; }
.ec-chat__unread { display: grid; place-items: center; min-width: 22px; height: 22px; padding: 0 4px; border-radius: 99px; background: var(--ec-accent); color: var(--ec-on-accent); font-weight: 800; font-size: 12px; }
.ec-chat__request { display: flex; flex-direction: column; gap: 5px; margin: 8px 0; padding: 12px; border: 1px solid var(--ec-border); border-radius: 12px; background: var(--ec-panel); }
.ec-chat__request strong { font-size: 14px; }
.ec-chat__request small { color: var(--ec-muted); }
.ec-chat__request-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.ec-chat__primary, .ec-chat__secondary, .ec-chat__send, .ec-chat__block {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 14px;
  border: 1px solid var(--ec-accent);
  border-radius: 9px;
  background: var(--ec-accent);
  color: var(--ec-on-accent);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
  text-decoration: none;
  cursor: pointer;
}
.ec-chat__primary:hover, .ec-chat__send:hover { background: var(--ec-accent-hover); border-color: var(--ec-accent-hover); }
.ec-chat__secondary, .ec-chat__block { border-color: var(--ec-border); background: var(--ec-interactive); color: var(--ec-body); }
.ec-chat__secondary:hover, .ec-chat__block:hover { background: var(--ec-hover); color: var(--ec-text); }
.ec-chat__pending { margin: 5px 8px; padding: 8px 12px; border: 1px solid var(--ec-border); border-radius: 9px; color: var(--ec-muted); font-size: 12px; }
.ec-chat__thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--ec-thread); }
.ec-chat__thread-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--ec-border); }
.ec-chat__thread-identity { display: flex; flex: 1; min-width: 0; flex-direction: column; }
.ec-chat__thread-identity strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.ec-chat__profile-link { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ec-accent); font-size: 15px; font-weight: 750; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--ec-accent) 45%, transparent); text-underline-offset: 3px; }
.ec-chat__profile-link:hover { color: var(--ec-accent-hover); text-decoration-color: currentColor; }
.ec-chat__thread-identity span { font-size: 11px; color: var(--ec-muted); }
.ec-chat__thread-identity .ec-chat__peer-status { display: inline-flex; align-items: center; gap: 6px; color: var(--ec-muted); font-size: 12px; }
.ec-chat__peer-status::before { content: ""; flex: 0 0 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--ec-muted); }
.ec-chat__thread-identity .ec-chat__peer-status[data-state=online] { color: var(--ec-success); }
.ec-chat__peer-status[data-state=online]::before { background: var(--ec-success); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ec-success) 12%, transparent); }
.ec-chat__thread-identity .ec-chat__peer-status[data-state=typing] { color: var(--ec-accent); }
.ec-chat__peer-status[data-state=typing]::before { background: var(--ec-accent); }
.ec-chat__block { padding: 5px 10px; font-size: 12px; }
.ec-chat__confirm { padding: 12px 16px; border-bottom: 1px solid var(--ec-border); background: var(--ec-sidebar); color: var(--ec-body); }
.ec-chat__confirm strong { font-size: 13px; }
.ec-chat__messages {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow: auto;
  padding: 22px 20px;
  scrollbar-color: var(--ec-border-strong) transparent;
  overscroll-behavior: contain;
}
.ec-chat__messages > :first-child { margin-top: auto; }
.ec-chat__line { display: flex; flex: 0 0 auto; justify-content: flex-start; margin: 5px 0; }
.ec-chat__line.is-mine { justify-content: flex-end; }
.ec-chat__bubble {
  min-width: min(128px, 100%);
  max-width: min(82%, 490px);
  padding: 11px 14px 8px;
  border: 1px solid var(--ec-border);
  border-radius: 16px 16px 16px 5px;
  background: var(--ec-interactive);
  color: var(--ec-text);
  box-shadow: var(--shadow-1, 0 2px 7px rgb(0 0 0 / .08));
}
.ec-chat__line.is-mine .ec-chat__bubble {
  border-color: var(--ec-accent);
  border-radius: 16px 16px 5px 16px;
  background: var(--ec-accent);
  color: var(--ec-on-accent);
}
.ec-chat[dir=rtl] .ec-chat__bubble { border-radius: 16px 16px 5px 16px; }
.ec-chat[dir=rtl] .ec-chat__line.is-mine .ec-chat__bubble { border-radius: 16px 16px 16px 5px; }
.ec-chat__bubble p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; unicode-bidi: plaintext; font-size: 15px; line-height: 1.7; }
.ec-chat__quoted { display: flex; flex-direction: column; gap: 3px; max-width: 100%; margin-bottom: 8px; padding: 7px 10px; border-inline-start: 3px solid currentColor; border-radius: 6px; background: color-mix(in srgb, currentColor 8%, transparent); font-size: 12px; overflow-wrap: anywhere; unicode-bidi: plaintext; }
.ec-chat__quoted strong, .ec-chat__quoted span { color: inherit; }
.ec-chat__quoted span { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; white-space: pre-wrap; opacity: .83; }
.ec-chat__reply, .ec-chat__report {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 5px;
  padding: 3px 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: inherit;
  opacity: .84;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.ec-chat__reply:hover, .ec-chat__report:hover { background: color-mix(in srgb, currentColor 11%, transparent); opacity: 1; }
.ec-chat__reply .ec-chat__icon, .ec-chat__report .ec-chat__icon { width: 14px; height: 14px; flex-basis: 14px; }
.ec-chat__meta { display: flex; align-items: center; justify-content: flex-end; gap: 7px; min-height: 15px; margin-top: 5px; }
.ec-chat__bubble time { display: inline-block; color: inherit; opacity: .72; font-size: 11px; direction: ltr; }
.ec-chat__receipt { display: inline-flex; align-items: center; color: inherit; opacity: .75; direction: ltr; unicode-bidi: isolate; }
.ec-chat__receipt .ec-chat__icon { width: 15px; height: 15px; flex-basis: 15px; }
.ec-chat__receipt.is-read { opacity: 1; }
.ec-chat__typing-indicator { display: flex; align-items: center; gap: 9px; padding: 5px 20px 8px; color: var(--ec-accent); background: var(--ec-thread); font-size: 12px; }
.ec-chat__typing-indicator[hidden], .ec-chat__reply-preview[hidden] { display: none !important; }
.ec-chat__typing-dots { display: inline-flex; align-items: center; gap: 3px; direction: ltr; }
.ec-chat__typing-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; animation: ec-chat-typing-pulse 1.25s ease-in-out infinite; }
.ec-chat__typing-dot:nth-child(2) { animation-delay: .15s; }
.ec-chat__typing-dot:nth-child(3) { animation-delay: .3s; }
@keyframes ec-chat-typing-pulse { 0%, 60%, 100% { opacity: .35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
.ec-chat__composer { display: flex; flex-direction: column; gap: 9px; padding: 12px 16px 14px; border-top: 1px solid var(--ec-border); background: var(--ec-sidebar); }
.ec-chat__composer-fields { display: flex; align-items: flex-end; gap: 10px; }
.ec-chat__reply-preview { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 8px 11px; border-inline-start: 3px solid var(--ec-accent); border-radius: 7px; background: var(--ec-selected); color: var(--ec-body); font-size: 12px; }
.ec-chat__reply-preview-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; unicode-bidi: plaintext; }
.ec-chat__reply-cancel { width: 26px; height: 26px; border-color: transparent; background: transparent; }
.ec-chat__reply-cancel .ec-chat__icon { width: 14px; height: 14px; flex-basis: 14px; }
.ec-chat__input {
  flex: 1;
  min-width: 0;
  min-height: 52px;
  max-height: 144px;
  resize: vertical;
  padding: 11px 13px;
  border: 1px solid var(--ec-field-border);
  border-radius: 12px;
  outline: 0;
  background: var(--ec-field);
  color: var(--ec-field-text);
  font: inherit;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.65;
  unicode-bidi: plaintext;
  transition: border-color var(--motion-normal, 160ms), box-shadow var(--motion-normal, 160ms);
}
.ec-chat__input:focus { border-color: var(--ec-focus); outline: 0; box-shadow: 0 0 0 2px color-mix(in srgb, var(--ec-focus) 24%, transparent); }
.ec-chat__send { min-height: 52px; padding: 9px 17px; }
.ec-chat__send:disabled { opacity: .55; cursor: wait; }
.ec-chat__empty { max-width: 340px; margin: auto; padding: 24px; color: var(--ec-muted); text-align: center; line-height: 1.9; }
.ec-chat__guest { display: flex; flex-direction: column; align-items: center; gap: 18px; width: 100%; margin: auto; padding: 24px; text-align: center; }
.ec-chat__guest .ec-chat__empty { margin: 0; padding: 0; }
.ec-chat__guest .ec-chat__primary { min-width: 170px; align-self: center; }
.ec-chat__contact { display: inline-flex; align-items: center; justify-content: center; gap: 7px; margin: 8px 10px; padding: 9px 14px; border: 1px solid var(--ec-accent); border-radius: 11px; background: var(--ec-selected); color: var(--ec-accent); font: inherit; font-size: 13px; font-weight: 700; line-height: 1.5; text-decoration: none; cursor: pointer; vertical-align: middle; }
.ec-chat__contact:hover { background: var(--ec-hover); }
.ec-chat button:focus-visible, .ec-chat a:focus-visible, .ec-chat__launcher:focus-visible { outline: 2px solid var(--ec-focus); outline-offset: 2px; }
@media (max-width: 720px) {
  .ec-chat__overlay { padding: 0; align-items: stretch; }
  .ec-chat__panel { width: 100%; height: 100%; max-height: 100dvh; border: 0; border-radius: 0; }
  .ec-chat__head { padding: 12px 16px; }
  .ec-chat__body { display: block; position: relative; }
  .ec-chat__sidebar, .ec-chat__thread { position: absolute; inset: 0; }
  .ec-chat__thread { display: none; }
  .ec-chat__body.is-thread-open .ec-chat__sidebar { display: none; }
  .ec-chat__body.is-thread-open .ec-chat__thread { display: flex; }
  .ec-chat__back { display: grid; }
  .ec-chat__close, .ec-chat__back { width: 44px; height: 44px; }
  .ec-chat__thread-head { padding: 10px 14px; }
  .ec-chat__messages { padding: 16px 14px 18px; }
  .ec-chat__typing-indicator { padding-inline: 14px; }
  .ec-chat__bubble { max-width: min(88%, 490px); }
  .ec-chat__composer { padding: 10px 14px max(12px, env(safe-area-inset-bottom)); }
  .ec-chat__input { font-size: 16px; }
  .ec-chat__heading span { font-size: 11px; }
  .ec-chat__launcher { min-width: 37px; height: 37px; margin-inline-end: 4px; }
}
@media (min-width: 721px) { .ec-chat__back { display: none; } }
/* Messenger-style full-viewport workspace. The rest of Egytag keeps its normal chrome. */
/* This route owns its viewport; editorial fixed/flow widgets must not push the
   app below the fold or cover chats (notably the article-push launcher). */
html:has(> body.ec-message-center-page) { height: 100%; overflow: hidden; }
body.ec-message-center-page > .egytag-push-launcher,
body.ec-message-center-page > .egxu-hub,
body.ec-message-center-page > .back-to-top,
body.ec-message-center-page > eg-reading-progress { display: none !important; }
body.ec-message-center-page {
  width: 100%;
  height: 100dvh;
  min-height: 0;
  margin: 0;
  overflow: hidden;
  background: var(--ds-surface-base, var(--surface-canvas, #171a1d));
}
.ec-message-center__topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 62px;
  padding: 0 clamp(14px, 2.3vw, 32px);
  border-bottom: 1px solid var(--ds-border-default, var(--border-subtle, #3c4c53));
  background: var(--ds-surface-panel, var(--surface-raised, #1d282d));
  color: var(--ds-text-strong, var(--text-primary, #f1f5f6));
}
.ec-message-center__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
  font-size: 17px;
  line-height: 1.2;
}
.ec-message-center__brand strong { font: 900 23px/1.1 system-ui, sans-serif; letter-spacing: -.045em; }
.ec-message-center__brand span { color: var(--ds-text-muted, var(--text-muted, #9fb2b7)); font-size: 14px; font-weight: 750; }
.ec-message-center__brand-icon {
  display: block;
  flex: 0 0 37px;
  width: 37px;
  height: 37px;
  padding: 8px;
  border-radius: 13px;
  background: var(--ds-action-primary-bg, #218f8a);
  fill: none;
  stroke: var(--ds-action-primary-text, #fff);
  stroke-width: 2;
}
.ec-message-center__community-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid var(--ds-border-default, var(--border-subtle, #46565d));
  border-radius: 20px;
  background: var(--ds-surface-interactive, var(--surface-muted, #26343a));
  color: var(--ds-text-default, #d9e4e5);
  text-decoration: none;
  font-size: 13px;
  font-weight: 750;
}
.ec-message-center__community-link:hover { background: var(--ds-surface-interactive-hover, #34484c); }
.ec-message-center__community-link svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
body.ec-message-center-page > eg-page {
  display: block;
  width: 100%;
  max-width: none;
  height: calc(100dvh - 62px);
  min-height: 0;
  margin: 0;
  padding: 0;
}
.ec-message-center { width: 100%; max-width: none; height: 100%; min-height: 0; margin: 0; padding: 0; }
.ec-message-center__screen-reader { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.ec-message-center__mount, .ec-chat--hub { width: 100%; height: 100%; min-height: 0; }
.ec-chat--hub .ec-chat__overlay {
  position: relative;
  inset: auto;
  z-index: auto;
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  background: transparent;
  backdrop-filter: none;
}
.ec-chat--hub .ec-chat__panel {
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.ec-chat--hub .ec-chat__body {
  position: relative;
  grid-template-columns: clamp(290px, 22vw, 370px) minmax(0, 1fr) clamp(280px, 23vw, 350px);
  min-height: 0;
}
.ec-chat--hub .ec-chat__sidebar { min-height: 0; overflow: auto; }
.ec-chat--hub .ec-chat__head {
  position: sticky;
  top: 0;
  z-index: 2;
  min-height: 77px;
  padding: 15px 16px;
  background: var(--ec-sidebar);
}
.ec-chat--hub .ec-chat__heading strong { font-size: 20px; }
.ec-chat--hub .ec-chat__heading span { font-size: 11px; }
.ec-chat--hub .ec-chat__list { padding: 12px 10px 20px; }
.ec-chat--hub .ec-chat__tabs { display: flex; gap: 5px; margin-bottom: 14px; }
.ec-chat--hub .ec-chat__tab {
  flex: 1;
  flex-direction: row;
  gap: 5px;
  min-height: 39px;
  padding: 7px 8px;
  border-color: transparent;
  border-radius: 20px;
  background: transparent;
  font-size: 12px;
  white-space: nowrap;
}
.ec-chat--hub .ec-chat__tab.is-active { background: var(--ec-selected); border-color: transparent; }
.ec-chat--hub .ec-chat__tab .ec-chat__icon { width: 15px; height: 15px; flex-basis: 15px; }
.ec-chat--hub .ec-chat__new { min-height: 42px; border-radius: 13px; margin-bottom: 4px; }
.ec-chat--hub .ec-chat__search-wrap { margin-top: 12px; }
.ec-chat--hub .ec-chat__search { min-height: 42px; border-radius: 21px; }
.ec-chat--hub .ec-chat__conversation { gap: 12px; min-height: 72px; padding: 10px; border-radius: 12px; }
.ec-chat--hub .ec-chat__avatar { flex-basis: 49px; width: 49px; height: 49px; font-size: 20px; }
.ec-chat--hub .ec-chat__conversation-copy strong { font-size: 14px; }
.ec-chat--hub .ec-chat__conversation-copy small { font-size: 12px; }
.ec-chat--hub .ec-chat__thread-head {
  flex: 0 0 auto;
  min-height: 77px;
  padding: 13px clamp(16px, 2.2vw, 26px);
  background: var(--ec-panel);
}
.ec-chat__thread-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 43px;
  width: 43px;
  height: 43px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--ec-accent) 17%, var(--ec-panel));
  color: var(--ec-accent);
  font-weight: 800;
  font-size: 18px;
}
.ec-chat__details-toggle, .ec-chat__details-close {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--ec-interactive);
  color: var(--ec-accent);
  cursor: pointer;
}
.ec-chat__details-toggle:hover, .ec-chat__details-close:hover { background: var(--ec-hover); }
.ec-chat--hub .ec-chat__messages { padding: 24px clamp(15px, 2.7vw, 45px); }
.ec-chat--hub .ec-chat__line { margin: 3px 0; }
.ec-chat--hub .ec-chat__bubble { max-width: min(75%, 570px); border-radius: 18px; box-shadow: none; }
.ec-chat--hub .ec-chat__composer { gap: 7px; padding: 12px clamp(15px, 2.7vw, 32px) 14px; background: var(--ec-panel); }
.ec-chat--hub .ec-chat__input { min-height: 45px; max-height: 132px; border-radius: 24px; resize: vertical; }
.ec-chat--hub .ec-chat__send { min-height: 45px; border-radius: 23px; }
.ec-chat--hub .ec-chat__details {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  border-inline-start: 1px solid var(--ec-border);
  background: var(--ec-sidebar);
}
.ec-chat__details-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 77px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--ec-border);
}
.ec-chat__details-top strong { font-size: 14px; }
.ec-chat__details-hero { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 28px 15px 22px; text-align: center; }
.ec-chat__details-avatar { display: grid; place-items: center; width: 92px; height: 92px; border: 2px solid color-mix(in srgb, var(--ec-accent) 30%, transparent); border-radius: 50%; background: var(--ec-selected); color: var(--ec-accent); font-size: 36px; font-weight: 850; }
.ec-chat__details-name { font-size: 20px; line-height: 1.4; overflow-wrap: anywhere; }
.ec-chat__details-status { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ec-muted); }
.ec-chat__details-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ec-muted); }
.ec-chat__details-status[data-state=online] { color: var(--ec-success); }
.ec-chat__details-status[data-state=online]::before { background: var(--ec-success); }
.ec-chat__details-status[data-state=typing] { color: var(--ec-accent); }
.ec-chat__details-status[data-state=typing]::before { background: var(--ec-accent); }
.ec-chat__details-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; padding: 0 16px 22px; }
.ec-chat__details-action, .ec-chat__details-block {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--ec-border);
  border-radius: 18px;
  background: var(--ec-interactive);
  color: var(--ec-text);
  text-decoration: none;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.ec-chat__details-action[hidden] { display: none; }
.ec-chat__details-action:hover, .ec-chat__details-block:hover { background: var(--ec-hover); }
.ec-chat__details-section { padding: 18px 20px; border-top: 1px solid var(--ec-border); }
.ec-chat__details-section h3 { margin: 0 0 10px; font-size: 15px; }
.ec-chat__details-section p { margin: 0 0 18px; color: var(--ec-muted); font-size: 13px; line-height: 1.8; }
.ec-chat__details-block { color: var(--ec-danger); }
.ec-chat--hub .ec-chat__welcome {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 15px;
  width: min(510px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  margin: auto;
  padding: clamp(24px, 3.4vw, 44px);
  border: 1px solid var(--ec-border);
  border-radius: 24px;
  background: color-mix(in srgb, var(--ec-panel) 84%, transparent);
  text-align: center;
}
.ec-chat--hub .ec-chat__welcome-icon {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 24px;
  background: var(--ec-selected);
  color: var(--ec-accent);
}
.ec-chat--hub .ec-chat__welcome-icon .ec-chat__icon { width: 34px; height: 34px; flex-basis: 34px; }
.ec-chat--hub .ec-chat__welcome h2 { margin: 0; font-size: clamp(21px, 1.8vw, 26px); line-height: 1.45; }
.ec-chat--hub .ec-chat__welcome p { max-width: 365px; margin: 0; color: var(--ec-muted); font-size: 14px; line-height: 1.85; }
.ec-chat--hub .ec-chat__welcome-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 6px; }
.ec-chat--hub .ec-chat__welcome-actions button { min-height: 43px; border-radius: 12px; }
.ec-chat__details-empty { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 25px; color: var(--ec-muted); text-align: center; }
.ec-chat__details-empty strong { font-size: 17px; color: var(--ec-text); }
.ec-chat__details-empty p { font-size: 13px; line-height: 1.8; }
@media (min-width: 1180px) {
  .ec-chat--hub .ec-chat__body.is-details-hidden { grid-template-columns: clamp(290px, 22vw, 370px) minmax(0, 1fr); }
  .ec-chat--hub .ec-chat__body.is-details-hidden .ec-chat__details { display: none; }
}
@media (max-width: 1179px) {
  .ec-chat--hub .ec-chat__body { grid-template-columns: clamp(270px, 30vw, 350px) minmax(0, 1fr); }
  .ec-chat--hub .ec-chat__details { display: none; position: absolute; z-index: 3; inset-block: 0; inset-inline-end: 0; width: min(355px, 100%); box-shadow: 0 0 28px rgb(0 0 0 / .14); }
  .ec-chat--hub .ec-chat__body.is-details-open .ec-chat__details { display: flex; }
}
@media (max-width: 720px) {
  .ec-message-center__topbar { height: 54px; padding: 0 12px; }
  .ec-message-center__brand strong { font-size: 20px; }
  .ec-message-center__brand span { font-size: 13px; }
  .ec-message-center__brand-icon { flex-basis: 32px; width: 32px; height: 32px; padding: 7px; border-radius: 10px; }
  .ec-message-center__community-link { padding: 7px 9px; font-size: 11px; }
  body.ec-message-center-page > eg-page { height: calc(100dvh - 54px); }
  .ec-chat--hub .ec-chat__body { display: block; }
  .ec-chat--hub .ec-chat__head, .ec-chat--hub .ec-chat__thread-head { min-height: 65px; padding: 10px 13px; }
  .ec-chat--hub .ec-chat__sidebar, .ec-chat--hub .ec-chat__thread { position: absolute; inset: 0; }
  .ec-chat--hub .ec-chat__details { width: 100%; inset: 0; box-shadow: none; }
  .ec-chat--hub .ec-chat__messages { padding: 16px 13px; }
  .ec-chat--hub .ec-chat__bubble { max-width: min(87%, 490px); }
  .ec-chat--hub .ec-chat__composer { padding: 10px 12px max(10px, env(safe-area-inset-bottom)); }
  .ec-chat--hub .ec-chat__thread-avatar { flex-basis: 36px; width: 36px; height: 36px; font-size: 15px; }
  .ec-chat--hub .ec-chat__thread-identity strong { font-size: 14px; }
}
.ec-chat[dir=rtl] .ec-chat__back .ec-chat__icon { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) {
  .ec-chat__launcher, .ec-chat__conversation, .ec-chat__input { transition: none; }
  .ec-chat__typing-dot { animation: none; opacity: 1; }
}
