:root {
  --dlc-primary: #ff5c35;
  --dlc-primary-soft: #fff2ee;
  --dlc-bg: #f6f7f9;
  --dlc-card: #fff;
  --dlc-border: #e8e9ed;
  --dlc-text: #20242c;
  --dlc-muted: #7b8290;
  --dlc-shadow: 0 18px 55px rgba(25, 31, 45, .14);
}

html.dlc-lock { overflow: hidden; }
.dlc-app,
.dlc-app *,
.dlc-modal,
.dlc-modal * { box-sizing: border-box; }

.dlc-start-chat {
  appearance: none;
  border: 1px solid var(--dlc-primary);
  border-radius: 11px;
  background: var(--dlc-primary);
  color: #fff;
  min-height: 44px;
  padding: 9px 18px;
  margin: 10px 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.6;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
  box-shadow: 0 7px 18px rgba(255, 92, 53, .18);
}
.dlc-start-chat:hover {
  color: #fff;
  transform: translateY(-1px);
  filter: brightness(.98);
  box-shadow: 0 10px 24px rgba(255, 92, 53, .24);
}
.dlc-start-chat svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dlc-modal {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: none;
  direction: rtl;
}
.dlc-modal.open { display: block; }
.dlc-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 23, 35, .52);
  backdrop-filter: blur(3px);
}
.dlc-dialog {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(1120px, calc(100vw - 48px));
  height: min(720px, calc(100dvh - 64px));
  min-height: 540px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .8);
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--dlc-shadow);
}
.dlc-close {
  position: absolute;
  z-index: 20;
  top: 15px;
  left: 15px;
  width: 36px;
  height: 36px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid #e0e3e8;
  border-radius: 10px;
  background: #fff;
  color: #454b57;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(23, 30, 45, .06);
}
.dlc-close:hover { background: #f6f7f9; color: #111827; }
.dlc-close svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.dlc-app {
  direction: rtl;
  width: 100%;
  height: 100%;
  min-height: 540px;
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  overflow: hidden;
  background: #fff;
  color: var(--dlc-text);
  font-family: inherit;
}
.dlc-embedded {
  height: 720px;
  min-height: 620px;
  overflow: hidden;
  border: 1px solid var(--dlc-border);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(23, 30, 45, .06);
}

.dlc-sidebar {
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-left: 1px solid var(--dlc-border);
  background: #fff;
}
.dlc-sidebar-head {
  flex: 0 0 auto;
  padding: 18px 16px 13px;
  border-bottom: 1px solid var(--dlc-border);
  background: #fff;
}
.dlc-title-row {
  min-height: 30px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.dlc-title-row h2 {
  margin: 0;
  color: #20242b;
  font-size: 18px;
  font-weight: 900;
  line-height: 1.5;
}
.dlc-total-badge,
.dlc-conv em {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--dlc-primary);
  color: #fff;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  line-height: 1;
}
.dlc-search {
  height: 42px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #e2e4e9;
  border-radius: 10px;
  background: #f8f9fb;
  color: #8b92a0;
  transition: border-color .15s ease, background .15s ease;
}
.dlc-search:focus-within {
  border-color: rgba(255, 92, 53, .5);
  background: #fff;
}
.dlc-search svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}
.dlc-search input {
  width: 100%;
  height: 38px;
  min-height: 0;
  padding: 0;
  border: 0 !important;
  outline: 0 !important;
  background: transparent !important;
  color: var(--dlc-text);
  box-shadow: none !important;
  font: inherit;
  font-size: 12px;
}
.dlc-search input::placeholder { color: #a0a5af; }
.dlc-filters {
  margin-top: 11px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.dlc-filters button {
  min-height: 30px;
  padding: 4px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  color: #6c7380;
  font: inherit;
  font-size: 10.5px;
  cursor: pointer;
}
.dlc-filters button.active {
  border-color: rgba(255, 92, 53, .28);
  background: var(--dlc-primary-soft);
  color: var(--dlc-primary);
  font-weight: 800;
}
.dlc-conversations {
  flex: 1;
  min-height: 0;
  padding: 7px 9px 12px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #d9dce2 transparent;
}
.dlc-list-loading {
  padding: 28px 12px;
  text-align: center;
  color: var(--dlc-muted);
  font-size: 11px;
}
.dlc-conv {
  position: relative;
  width: 100%;
  min-height: 76px;
  margin: 1px 0;
  padding: 10px 9px;
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: inherit;
  text-align: right;
  font: inherit;
  cursor: pointer;
  transition: background .14s ease, border-color .14s ease;
}
.dlc-conv::after {
  position: absolute;
  right: 9px;
  bottom: 0;
  left: 9px;
  height: 1px;
  content: '';
  background: #f0f1f3;
}
.dlc-conv:hover { background: #fafafb; }
.dlc-conv.active {
  border-color: #ffe1d8;
  background: var(--dlc-primary-soft);
}
.dlc-conv.active::after { display: none; }
.dlc-avatar-wrap {
  position: relative;
  width: 45px;
  height: 45px;
  flex: 0 0 45px;
}
.dlc-avatar-wrap img,
.dlc-avatar-fallback,
.dlc-head-avatar img,
.dlc-head-avatar .dlc-avatar-fallback {
  width: 45px;
  height: 45px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: #eef0f4;
  color: #596170;
  object-fit: cover;
  font-size: 15px;
  font-weight: 900;
}
.dlc-online {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 11px;
  height: 11px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #24b45a;
}
.dlc-conv-main {
  min-width: 0;
  flex: 1;
}
.dlc-conv-row {
  display: flex;
  align-items: center;
  gap: 7px;
}
.dlc-conv-row b {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  color: #252a32;
  font-size: 12.5px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dlc-conv-row time {
  flex: 0 0 auto;
  color: #a0a5af;
  font-size: 9px;
}
.dlc-preview,
.dlc-product-line {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dlc-preview {
  margin-top: 4px;
  color: #777e8a;
  font-size: 10.5px;
}
.dlc-product-line {
  margin-top: 3px;
  color: var(--dlc-primary);
  font-size: 9px;
}
.dlc-conv em {
  position: absolute;
  left: 9px;
  bottom: 9px;
}

.dlc-chat {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--dlc-bg);
}
.dlc-chat-head {
  min-height: 72px;
  padding: 10px 19px 10px 62px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--dlc-border);
  background: #fff;
}
.dlc-head-avatar {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
}
.dlc-head-avatar img,
.dlc-head-avatar .dlc-avatar-fallback {
  width: 44px;
  height: 44px;
}
.dlc-head-person {
  min-width: 0;
  display: block;
}
.dlc-head-person > b {
  display: block;
  overflow: hidden;
  color: #22272f;
  font-size: 13px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dlc-head-person small {
  display: block;
  margin-top: 3px;
  color: #8a919d;
  font-size: 10px;
}
.dlc-head-person small i {
  width: 7px;
  height: 7px;
  margin-left: 3px;
  display: inline-block;
  border-radius: 50%;
  background: #24b45a;
}
.dlc-mobile-back { display: none; }
.dlc-chat-product {
  min-width: 0;
  max-width: 280px;
  margin-right: auto;
  padding: 5px 7px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #eceef1;
  border-radius: 10px;
  background: #fafafb;
  color: inherit;
  text-decoration: none !important;
}
.dlc-chat-product:hover { border-color: #ffd7cb; color: inherit; }
.dlc-chat-product img,
.dlc-product-placeholder {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: #eef0f3;
  object-fit: cover;
}
.dlc-chat-product span { min-width: 0; display: block; }
.dlc-chat-product small,
.dlc-chat-product b {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dlc-chat-product small { color: #999faa; font-size: 8.5px; }
.dlc-chat-product b { max-width: 205px; margin-top: 2px; color: #4d535d; font-size: 10px; }

.dlc-messages {
  flex: 1;
  min-height: 0;
  padding: 24px 26px 16px;
  overflow: auto;
  background-color: var(--dlc-bg);
  background-image: radial-gradient(circle at 1px 1px, rgba(91, 99, 116, .055) 1px, transparent 0);
  background-size: 22px 22px;
  scroll-behavior: smooth;
}
.dlc-messages-loading,
.dlc-first-message {
  width: max-content;
  max-width: 90%;
  margin: 16px auto;
  padding: 7px 12px;
  border-radius: 999px;
  background: #e9ebef;
  color: #767d89;
  font-size: 10px;
  text-align: center;
}
.dlc-msg {
  width: fit-content;
  max-width: min(70%, 560px);
  margin: 8px 0;
  clear: both;
}
.dlc-msg.mine { margin-right: auto; }
.dlc-msg.other { margin-left: auto; }
.dlc-bubble {
  padding: 9px 13px;
  border-radius: 15px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12.5px;
  line-height: 1.85;
  box-shadow: 0 1px 2px rgba(22, 27, 38, .05);
}
.dlc-msg.mine .dlc-bubble {
  border-bottom-left-radius: 4px;
  background: var(--dlc-primary);
  color: #fff;
}
.dlc-msg.other .dlc-bubble {
  border: 1px solid #e7e9ed;
  border-bottom-right-radius: 4px;
  background: #fff;
  color: #303640;
}
.dlc-msg > small {
  margin: 3px 6px 0;
  display: block;
  color: #999faa;
  font-size: 9px;
}
.dlc-msg.pending { opacity: .62; }
.dlc-msg.failed .dlc-bubble { outline: 1px solid #dc3545; }
.dlc-msg.failed > small::after {
  margin-right: 5px;
  content: 'ارسال ناموفق';
  color: #dc3545;
}
.dlc-read-state {
  margin-right: 3px;
  color: #7f8794;
  letter-spacing: -2px;
}

.dlc-form {
  min-height: 66px;
  padding: 10px 12px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  border-top: 1px solid var(--dlc-border);
  background: #fff;
}
.dlc-form textarea {
  min-height: 44px !important;
  max-height: 120px;
  flex: 1;
  resize: none;
  padding: 10px 13px !important;
  border: 1px solid #dfe2e7 !important;
  border-radius: 12px !important;
  outline: 0 !important;
  background: #fafbfc !important;
  color: var(--dlc-text);
  box-shadow: none !important;
  font: inherit;
  font-size: 12.5px;
  line-height: 1.7;
}
.dlc-form textarea:focus {
  border-color: rgba(255, 92, 53, .52) !important;
  background: #fff !important;
}
.dlc-form button {
  height: 44px;
  min-width: 88px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0;
  border-radius: 11px;
  background: var(--dlc-primary);
  color: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.dlc-form button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform: scaleX(-1);
}

.dlc-empty,
.dlc-no-conv,
.dlc-login-card {
  margin: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--dlc-muted);
  text-align: center;
}
.dlc-empty strong,
.dlc-no-conv b { color: #484f5a; font-size: 12px; }
.dlc-empty small,
.dlc-no-conv small {
  margin-top: 5px;
  color: #969ca7;
  font-size: 10.5px;
  line-height: 1.8;
}
.dlc-empty-art {
  position: relative;
  width: 112px;
  height: 82px;
  margin-bottom: 15px;
  display: block;
}
.dlc-empty-art::before,
.dlc-empty-art::after {
  position: absolute;
  width: 66px;
  height: 45px;
  border: 3px solid #253b82;
  border-radius: 50%;
  content: '';
  transform: rotate(-12deg);
}
.dlc-empty-art::before { top: 25px; left: 6px; background: #ffd957; }
.dlc-empty-art::after { top: 7px; right: 2px; background: #ff704d; transform: rotate(12deg); }
.dlc-empty-art i,
.dlc-empty-art b {
  position: absolute;
  z-index: 2;
  top: 25px;
  width: 8px;
  height: 12px;
  border: 2px solid #253b82;
  border-radius: 50%;
  background: #fff;
}
.dlc-empty-art i { right: 48px; }
.dlc-empty-art b { right: 32px; }
.dlc-empty-mini {
  width: 38px;
  height: 38px;
  margin-bottom: 5px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #f1f2f5;
  color: var(--dlc-primary);
}
.dlc-spinner {
  width: 28px;
  height: 28px;
  margin-bottom: 12px;
  border: 3px solid #e5e7eb;
  border-top-color: var(--dlc-primary);
  border-radius: 50%;
  animation: dlc-spin .75s linear infinite;
}
@keyframes dlc-spin { to { transform: rotate(360deg); } }

.dlc-auth-view .dlc-sidebar { display: none; }
.dlc-auth-view { grid-template-columns: 1fr; }
.dlc-login-card {
  width: min(390px, calc(100% - 34px));
  padding: 32px 26px;
  border: 1px solid #e9ebef;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(24, 31, 45, .06);
}
.dlc-login-icon {
  width: 52px;
  height: 52px;
  margin-bottom: 14px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: var(--dlc-primary-soft);
  font-size: 22px;
}
.dlc-login-card h3 {
  margin: 0;
  color: #242a33;
  font-size: 17px;
  font-weight: 900;
}
.dlc-login-card p {
  margin: 8px 0 19px;
  color: #7e8591;
  font-size: 11.5px;
  line-height: 1.9;
}
.dlc-login-card a {
  min-width: 155px;
  padding: 10px 17px;
  border-radius: 10px;
  background: var(--dlc-primary);
  color: #fff !important;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none !important;
}
.dlc-start-error {
  width: min(390px, calc(100% - 34px));
  margin: auto;
  padding: 30px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 1px solid #f1d3cf;
  border-radius: 16px;
  background: #fff;
  color: #737b88;
  text-align: center;
  box-shadow: 0 8px 28px rgba(24, 31, 45, .06);
}
.dlc-start-error > span {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff0ed;
  color: #d92d20;
  font-size: 23px;
  font-weight: 900;
}
.dlc-start-error h3 {
  margin: 12px 0 0;
  color: #2c313a;
  font-size: 17px;
  font-weight: 900;
}
.dlc-start-error p {
  margin: 8px 0 17px;
  font-size: 11.5px;
  line-height: 1.9;
}
.dlc-start-error button {
  min-width: 135px;
  padding: 10px 16px;
  border: 0;
  border-radius: 10px;
  background: var(--dlc-primary);
  color: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.dlc-start-error small {
  margin-top: 10px;
  color: #9a9fa9;
  font-size: 9.5px;
}
.dlc-auth-standalone {
  display: flex;
  align-items: center;
  justify-content: center;
}

.dlc-toast {
  position: absolute;
  z-index: 40;
  right: 50%;
  bottom: 78px;
  transform: translateX(50%);
  max-width: calc(100% - 36px);
  padding: 9px 14px;
  border-radius: 10px;
  background: #252a33;
  color: #fff;
  box-shadow: 0 8px 25px rgba(0, 0, 0, .2);
  font-size: 11px;
  text-align: center;
}
.dlc-toast-error { background: #b42318; }

.dlc-dokan-dashboard-page .dlc-dokan-content { padding: 0 15px 28px; }
.dlc-dokan-dashboard-page .dlc-embedded {
  width: 100%;
  height: 720px;
  min-height: 620px;
}

/* Vendor dashboard only: third-party Dokan add-ons sometimes apply grid/card
   rules to every button inside dashboard content. Keep customer UI untouched. */
@media (min-width: 768px) {
  .dlc-dokan-dashboard-page .dokan-dashboard-content {
    padding-top: 0 !important;
  }
  .dlc-dokan-dashboard-page .dlc-dokan-content {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 15px 28px !important;
    float: none !important;
  }
  .dlc-dokan-dashboard-page .dlc-app {
    grid-template-columns: 350px minmax(0, 1fr) !important;
  }
  .dlc-dokan-dashboard-page .dlc-sidebar {
    width: auto !important;
    max-width: none !important;
  }
  .dlc-dokan-dashboard-page .dlc-conversations {
    display: block !important;
    grid-template-columns: none !important;
    columns: auto !important;
  }
  .dlc-dokan-dashboard-page .dlc-conv {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 86px !important;
    margin: 3px 0 !important;
    padding: 11px 10px !important;
    display: flex !important;
    float: none !important;
    clear: both !important;
    flex: none !important;
    align-items: center !important;
    border-radius: 10px !important;
    text-align: right !important;
  }
  .dlc-dokan-dashboard-page .dlc-conv-main {
    width: auto !important;
    min-width: 0 !important;
    display: block !important;
    flex: 1 1 auto !important;
  }
  .dlc-dokan-dashboard-page .dlc-conv-row,
  .dlc-dokan-dashboard-page .dlc-preview,
  .dlc-dokan-dashboard-page .dlc-product-line {
    width: 100% !important;
  }
}

@media (max-width: 767px) {
  .dlc-dialog {
    width: 100%;
    height: 100dvh;
    min-height: 0;
    border: 0;
    border-radius: 0;
  }
  .dlc-close {
    top: 10px;
    left: 10px;
    width: 34px;
    height: 34px;
  }
  .dlc-app {
    display: block;
    min-height: 100%;
  }
  .dlc-embedded {
    height: 72vh;
    min-height: 560px;
    border-radius: 12px;
  }
  .dlc-sidebar {
    width: 100%;
    height: 100%;
    border-left: 0;
  }
  .dlc-chat { display: none; width: 100%; height: 100%; }
  .dlc-app.dlc-chat-open .dlc-sidebar { display: none; }
  .dlc-app.dlc-chat-open .dlc-chat,
  .dlc-app.dlc-auth-view .dlc-chat { display: flex; }
  .dlc-sidebar-head { padding: 15px 13px 12px; }
  .dlc-title-row { padding-left: 40px; }
  .dlc-conversations { padding: 6px 7px 10px; }
  .dlc-conv { min-height: 72px; }
  .dlc-chat-head {
    min-height: 64px;
    padding: 8px 8px 8px 50px;
    gap: 8px;
  }
  .dlc-mobile-back {
    width: 34px;
    height: 34px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 9px;
    background: #f2f3f5;
    color: #4e5561;
  }
  .dlc-mobile-back svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  .dlc-head-avatar,
  .dlc-head-avatar img,
  .dlc-head-avatar .dlc-avatar-fallback {
    width: 38px;
    height: 38px;
  }
  .dlc-chat-product { max-width: 105px; padding: 4px; }
  .dlc-chat-product img,
  .dlc-product-placeholder { width: 32px; height: 32px; flex-basis: 32px; }
  .dlc-chat-product small { display: none; }
  .dlc-chat-product b { max-width: 60px; font-size: 9px; }
  .dlc-messages { padding: 15px 9px 10px; }
  .dlc-msg { max-width: 88%; }
  .dlc-bubble { padding: 8px 10px; font-size: 11.5px; }
  .dlc-form { min-height: 58px; padding: 7px; gap: 6px; }
  .dlc-form textarea { min-height: 42px !important; padding: 9px 10px !important; }
  .dlc-form button { min-width: 44px; height: 42px; padding: 0 12px; }
  .dlc-form button span { display: none; }
  .dlc-login-card { padding: 25px 18px; }
  .dlc-dokan-dashboard-page .dlc-dokan-content { padding: 0 7px 18px; }
  .dlc-dokan-dashboard-page .dlc-embedded { height: 72vh; min-height: 560px; }
}
