/* OrderFlow Connect — v3.9.0: photos and left-aligned chat including DMs.
   This CSS does not change account permissions, storage or chat APIs. */
:root {
  color-scheme: dark;
  --page: #090d15;
  --surface: #101723;
  --surface-raised: #151e2d;
  --surface-soft: #1b2637;
  --stroke: #2a3546;
  --muted: #98a7bd;
  --text: #edf3fc;
  --accent: #e91845;
  --accent-deep: #b71135;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--page);
  font-synthesis: none;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { height: 100dvh; overflow: hidden; font-size: 15px; line-height: 1.45; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid #fd7895;
  outline-offset: 3px;
}
[hidden] { display: none !important; }
.sitebar {
  height: 72px;
  padding: 0 clamp(18px, 4vw, 64px);
  display: flex;
  align-items: center;
  gap: 25px;
  justify-content: space-between;
  background: #fff;
  border-bottom: 1px solid #e9ecf3;
  color: #172033;
}
.brand { display: inline-flex; align-items: center; gap: 12px; white-space: nowrap;
  color: #141c2d; font-weight: 900; font-size: 23px; letter-spacing: -0.9px; }
.brand-icon { display: grid; place-items: center; width: 42px; height: 42px;
  border-radius: 12px; background: var(--accent); color: #fff; font-size: 25px; }
.brand small { font-size: 11px; vertical-align: top; margin-left: 2px; }
.sitebar nav { display: flex; align-items: center; gap: 30px; color: #566174;
  font-size: 14px; font-weight: 750; }
.sitebar nav a:hover, .sitebar nav a.active { color: #d8123c; }
.sitebar nav a.active { position: relative; }
.sitebar nav a.active::after { content: ""; display: block; height: 3px; border-radius: 4px;
  position: absolute; bottom: -25px; left: 0; right: 0; background: var(--accent); }
.self-header { font-size: 13px; color: #495367; font-weight: 750; white-space: nowrap;
  overflow: hidden; max-width: 240px; text-overflow: ellipsis; }

.chat-layout {
  width: min(1560px, calc(100% - 40px));
  height: calc(100dvh - 100px);
  min-height: 420px;
  margin: 14px auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 298px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: 17px;
  box-shadow: 0 18px 70px #0005;
}
.message-panel { display: flex; flex-direction: column; min-height: 0; min-width: 0;
  grid-column: 1; background: #0f1622; }
.leftbar {
  display: flex; align-items: center; gap: 9px; flex-shrink: 0;
  padding: 14px 22px;
  min-height: 75px;
  background: #151d2a;
  border-bottom: 1px solid var(--stroke);
}
.leftbar .panel-label, .leftbar .left-footer, .leftbar .conversation-list,
.leftbar h1, .leftbar .sub { display: none; }
.area-button {
  display: flex; align-items: center; gap: 11px; flex: 0 0 auto;
  color: #bcc9dc; background: transparent; border: 1px solid transparent;
  border-radius: 10px; padding: 11px 17px; text-align: left;
  min-height: 48px;
  transition: background .15s ease, border-color .15s ease;
}
.area-button > span:first-child { color: #e2eaf6; font-size: 21px; line-height: 1; }
.area-button > span:nth-child(2) { font-size: 14px; font-weight: 800; }
.area-button small { display: block; color: #92a0b6; font-weight: 500; font-size: 11px; margin-top: 2px; }
.area-button:hover { background: #242c3c; }
.area-button.active { color: #fff; border-color: #a7284a; background: #402031; }
.area-button.active > span:first-child { color: #ff6e89; }
.area-button b { margin-left: 4px; color: #fff; background: var(--accent);
  border-radius: 50px; padding: 2px 7px; font-size: 11px; }

.message-header {
  flex-shrink: 0; min-height: 90px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; padding: 16px 29px;
  background: #101825;
  border-bottom: 1px solid var(--stroke);
}
.message-header h2 { margin: 0 0 5px; font-size: 21px; line-height: 1.2; letter-spacing: -0.4px; font-weight: 830; }
#room-subtitle { display: block; font-size: 13px; color: var(--muted); }
.room-status { display: inline-flex; align-items: center; gap: 7px; color: #becfe1; font-size: 13px; white-space: nowrap; }
.room-status i, .status-dot { display: inline-block; background: #23c88b;
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.message-scroll {
  min-height: 0; flex: 1; overflow: auto;
  scrollbar-color: #39465b #101722;
  overscroll-behavior: contain;
  background: radial-gradient(ellipse 90% 54% at 50% 0%, #19223370 0%, transparent 90%), #101722;
}
.message-list {
  width: 100%; max-width: none;
  min-height: 100%; margin: 0;
  padding: 28px clamp(16px, 2vw, 32px) 34px;
  display: flex; flex-direction: column; align-items: stretch; gap: 20px;
}
.date-separator {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  font-size: 11px; text-transform: uppercase; letter-spacing: 1.1px;
  color: #91a1b9; font-weight: 750; padding: 7px 0 3px;
}
.date-separator::before, .date-separator::after { content: ""; height: 1px; flex: 1; background: #303a4b; }
.welcome { background: #1b2738; border: 1px solid #334159; border-radius: 14px;
  padding: 24px; line-height: 1.6; color: #aebbcd; font-size: 14px; }
.welcome strong { display: block; color: #fff; font-size: 19px; margin-bottom: 5px; }
.message-item { display: flex; flex-direction: row; justify-content: flex-start; align-items: flex-start; gap: 13px; min-width: 0; width: 100%; }
.avatar { display: grid; flex: 0 0 auto; place-items: center;
  width: 43px; height: 43px; border-radius: 14px;
  color: #fff; font-weight: 850; font-size: 14px;
  background: linear-gradient(145deg, #eb2652, #8b1734);
  box-shadow: inset 0 0 0 1px #ffffff26;
}
.message-item.mine .avatar { background: linear-gradient(145deg, #db345a, #7d2542); }
.message-content { min-width: 0; max-width: min(88%, 765px); display: flex;
  align-items: flex-start; flex-direction: column; }
.message-meta { min-height: 23px; display: flex; align-items: center;
  gap: 8px; flex-wrap: wrap; margin: 0 0 6px; }
.message-meta strong { font-weight: 800; font-size: 15px; line-height: 1.1; color: #f4f7fd; }
.message-meta small { color: #95a3b7; font-size: 11px; font-weight: 560; }
.role-pill { display: inline-flex; align-items: center; font-size: 11px !important;
  font-weight: 780; border-radius: 5px; padding: 2px 7px; color: #bde4ff;
  background: #253e58; border: 1px solid #335979; }
.role-pill.Seller { color: #e4c6fd; background: #402850; border-color: #5d3977; }
.role-pill.Admin { color: #ffcbd6; background: #61243a; border-color: #9a3958; }
.role-pill.Staff { color: #bfeaf7; background: #1f4756; border-color: #386b7c; }
.message-bubble {
  display: inline-block; min-width: 58px; max-width: 100%; white-space: pre-wrap;
  overflow-wrap: anywhere; line-height: 1.6; font-size: 15px;
  color: #eef3fc; background: #202b3a; border: 1px solid #344359;
  border-radius: 4px 14px 14px 14px; padding: 11px 15px;
}
.message-item.public-self .message-bubble { background: #3a2535; border-color: #654254; }
.message-item.mine .message-bubble { background: #3a2535; border-color: #654254; }
/* Public chat is one unified left-aligned timeline, including your own posts. */
.chat-layout.is-dm .message-item.mine .message-bubble { background: #a81238;
  border-color: #cf254c; color: #fff; border-radius: 14px 4px 14px 14px; }
.admin-delete {
  opacity: 0; color: #aab6ca; background: transparent; border: 1px solid transparent;
  border-radius: 6px; padding: 3px 9px; margin-top: 5px; font-size: 12px;
  transition: opacity .12s, color .12s, background .12s;
}
.message-item:hover .admin-delete, .admin-delete:focus-visible { opacity: 1; }
.admin-delete:hover { color: #fff; background: #a31d3d; border-color: #be3456; }

.compose { flex: 0 0 auto; padding: 17px clamp(22px, 3vw, 40px) 18px;
  background: #151e2c; border-top: 1px solid #313f53; }
.compose form { display: flex; align-items: flex-end; gap: 12px; max-width: 1000px; margin: 0 auto; }
.compose textarea { display: block; flex: 1; min-width: 0;
  min-height: 56px; max-height: 150px; resize: vertical;
  padding: 15px 17px; color: #f4f8ff; background: #222f42;
  border: 1px solid #4b5a70; border-radius: 11px; outline: none;
  font-size: 15px; line-height: 1.55; }
.compose textarea::placeholder { color: #9eacc0; }
.compose textarea:focus { border-color: #f24b70; box-shadow: 0 0 0 3px #ed26531c; }
.primary { display: inline-flex; gap: 8px; align-items: center; justify-content: center;
  flex: 0 0 auto; border: 0; border-radius: 11px; padding: 15px 24px;
  min-height: 56px; background: var(--accent); color: #fff; font-weight: 830;
  box-shadow: 0 8px 18px #8a0d2d3d; }
.primary:hover { background: var(--accent-deep); }
.primary:disabled { cursor: not-allowed; opacity: .5; }
.compose > small { display: block; max-width: 1000px; margin: 8px auto 0;
  color: #9ba9bc; font-size: 11px; }
.notice { max-width: 1000px; margin: 0 auto 9px; color: #ffb0bd;
  font-size: 13px; background: #472231; border-radius: 8px; padding: 8px 12px; }

.members-panel { display: flex; flex-direction: column; min-width: 0; grid-column: 2; grid-row: 1;
  background: #151d2a; border-left: 1px solid var(--stroke); }
.member-top { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 27px 19px 14px; }
.member-top h2 { margin: 0; font-size: 18px; letter-spacing: -0.3px; }
.member-top h2 span { color: #96a7bd; margin-left: 4px; font-size: 14px; }
.member-top small { color: #b5c4d7; font-size: 12px; white-space: nowrap; }
.search-label { display: flex; align-items: center; gap: 8px; background: #222e3f;
  border: 1px solid #435066; border-radius: 10px; margin: 0 14px 13px;
  padding: 0 12px; color: #a0adc2; }
.search-label span { font-size: 24px; }
.search-label input { width: 100%; min-width: 0; padding: 13px 0;
  color: #e9f1fc; background: transparent; border: 0; outline: none; font-size: 13px; }
.search-label input::placeholder { color: #a1aec1; }
.member-list { flex: 1; min-height: 0; overflow: auto;
  scrollbar-color: #3b4859 #151d2a; }
.member-button { display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 11px 16px; border: 0; border-left: 3px solid transparent;
  color: #f0f4fc; background: transparent; text-align: left; }
.member-button:hover, .member-button.selected { background: #263248; border-left-color: #ed2250; }
.member-button:disabled { cursor: default; opacity: .8; }
.member-button .avatar { width: 39px; height: 39px; border-radius: 12px; font-size: 12px; }
.member-data { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.member-data strong { font-size: 13px; font-weight: 780; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.member-data small { font-size: 11px; color: #a7b5c9; }
.member-end { display: inline-flex; gap: 5px; align-items: center; }
.member-end i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #647489; }
.member-end i.on { background: #20cc8d; }
.member-end b { padding: 2px 6px; border-radius: 50px; color: #fff;
  font-size: 11px; background: var(--accent); }
.members-footer { padding: 18px; border-top: 1px solid var(--stroke); background: #151d2a;
  color: #9cacc2; font-size: 12px; line-height: 1.65; }

.signin { max-width: 560px; margin: 12vh auto; padding: 12px; }
.signin-inner { background: var(--surface-raised); border: 1px solid var(--stroke);
  border-radius: 19px; padding: 48px; text-align: center; }
.signin-symbol { font-size: 35px; color: #eb2a53; }
.signin h1 { font-size: 29px; }
.signin p { color: #b5c3d6; line-height: 1.6; margin-bottom: 22px; }

@media (max-width: 1000px) {
  .chat-layout { width: calc(100% - 20px); grid-template-columns: minmax(0,1fr) 244px; }
  .message-list { padding-inline: 23px; }
  .members-footer { font-size: 11px; }
  .member-top { flex-wrap: wrap; }
}
@media (max-width: 680px) {
  body { height: auto; overflow: auto; min-height: 100dvh; }
  .sitebar { height: 62px; padding-inline: 13px; gap: 10px; }
  .sitebar nav { gap: 12px; font-size: 12px; }
  .sitebar nav a.active::after { bottom: -21px; }
  .self-header { display: none; }
  .brand { font-size: 17px; gap: 8px; }
  .brand-icon { width: 34px; height: 34px; font-size: 20px; }
  .chat-layout { width: calc(100% - 12px); margin: 6px auto;
    display: flex; flex-direction: column; height: auto; min-height: 0;
    border-radius: 12px; overflow: visible; }
  .message-panel { height: min(77dvh, 820px); min-height: 420px; }
  .leftbar { min-height: 58px; padding: 7px; gap: 6px; }
  .area-button { flex: 1; justify-content: center; padding: 10px 5px; gap: 7px; }
  .area-button > span:first-child { font-size: 18px; }
  .area-button > span:nth-child(2) { font-size: 12px; }
  .area-button small { display: none; }
  .message-header { min-height: 76px; padding: 14px 17px; }
  .message-header h2 { font-size: 19px; }
  #room-subtitle { font-size: 11px; }
  .message-list { padding: 18px 12px 25px; gap: 16px; }
  .message-item { gap: 9px; }
  .avatar { width: 35px; height: 35px; border-radius: 11px; font-size: 12px; }
  .message-content { max-width: calc(100% - 44px); }
  .message-meta { gap: 5px; }
  .message-meta strong { font-size: 13px; }
  .message-meta small { font-size: 10px; }
  .message-bubble { font-size: 14px; padding: 10px 12px; }
  .compose { padding: 11px 10px 12px; }
  .compose form { gap: 8px; }
  .compose textarea { min-height: 50px; padding: 12px; font-size: 14px; }
  .primary { min-height: 50px; padding: 12px 16px; }
  .compose > small { display: none; }
  .members-panel { border-top: 1px solid var(--stroke); border-left: none;
    height: 265px; flex: 0 0 auto; }
  .member-top { flex-wrap: nowrap; padding: 14px 17px 9px; }
  .members-footer { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .area-button, .admin-delete { transition: none; }
}
@media (hover: none) {
  .admin-delete { opacity: 1; }
}

/* v3.8.9 — Public room is always a left-aligned community timeline.
   Even messages sent by the signed-in user have no outgoing class.
   The DM room alone uses the traditional incoming/outgoing alignment. */
.chat-layout:not(.is-dm) #message-list > .message-item {
  flex-direction: row !important;
  justify-content: flex-start !important;
  text-align: left;
  margin-inline: 0;
}
.chat-layout:not(.is-dm) #message-list > .message-item .message-content {
  align-items: flex-start !important;
  margin-inline: 0;
}
.chat-layout:not(.is-dm) #message-list > .message-item .message-meta {
  justify-content: flex-start !important;
}

/* v3.9.0: Public chat AND direct messages share the same left-aligned timeline. */
#message-list > .message-item,
.chat-layout.is-dm #message-list > .message-item {
  flex-direction: row !important;
  justify-content: flex-start !important;
  text-align: left;
}
.chat-layout.is-dm #message-list > .message-item .message-content {
  align-items: flex-start !important;
}
.chat-layout.is-dm #message-list > .message-item .message-meta {
  justify-content: flex-start !important;
}
.avatar { position: relative; overflow: hidden; }
.avatar img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; }
.avatar.has-photo { color: transparent; }

/* Lebanon Trading brand wordmark. */
.sitebar .brand{font-size:20px;letter-spacing:-.55px}.sitebar .brand-icon{font-size:14px;flex:0 0 42px}
@media(max-width:540px){.sitebar .brand{font-size:17px}}
