:root{
  --dslc-bot: 20px;
  --dslc-bubble-size: 58px;
  --dslc-offset: 0px;
  --dslc-gap: 10px;
  --dslc-radius: 22px;
  --dslc-shadow: 0 22px 54px rgba(15, 23, 42, 0.18);
  --dslc-bg: #0f172a;
  --dslc-accent: #2563eb;
  --dslc-accent-strong: #1d4ed8;
  --dslc-muted: #64748b;
  --dslc-surface: #f8fafc;
  --dslc-border: #dbe4f0;
}

#dslc-widget{
  position: fixed;
  right: 20px;
  bottom: calc(var(--dslc-bot) + var(--dslc-offset));
  z-index: 99999;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

#dslc-bubble{
  width: var(--dslc-bubble-size);
  height: var(--dslc-bubble-size);
  border-radius: 50%;
  border: 0;
  background: linear-gradient(135deg, var(--dslc-accent), var(--dslc-accent-strong));
  color: #fff;
  box-shadow: var(--dslc-shadow);
  cursor: pointer;
  position: relative;
  transition: transform .18s ease, box-shadow .18s ease;
}

#dslc-bubble:hover{
  transform: translateY(-1px) scale(1.02);
}

#dslc-bubble .i{
  font-size: 22px;
  display: inline-block;
  transform: translateY(1px);
}

#dslc-badge{
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-weight: 800;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  border: 2px solid #fff;
}

#dslc-bubble-label{ display: none !important; }

#dslc-panel{
  width: min(460px, calc(100vw - 28px));
  border-radius: var(--dslc-radius);
  background: #fff;
  box-shadow: var(--dslc-shadow);
  position: fixed;
  right: 20px;
  bottom: calc(var(--dslc-bot) + var(--dslc-offset) + var(--dslc-bubble-size) + var(--dslc-gap) + env(safe-area-inset-bottom));
  display: none;
  overflow: hidden;
  max-height: min(calc(100dvh - (var(--dslc-bot) + var(--dslc-offset) + var(--dslc-bubble-size) + var(--dslc-gap) + env(safe-area-inset-bottom)) - 12px - env(safe-area-inset-top)), 760px);
  min-height: min(560px, calc(100dvh - 28px));
}

#dslc-widget:not(.dslc-closed) #dslc-panel{
  display: flex;
  flex-direction: column;
}

.dslc-closed #dslc-panel{ display: none; }

.dslc-header{
  background: var(--dslc-bg);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.dslc-header .brand{
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.dslc-header .dot{ font-size: 14px; color: #22c55e; }
.dslc-header .dot.off{ color: #94a3b8; }

.dslc-header .title{
  font-weight: 800;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dslc-header .hours{
  font-size: 12px;
  color: #cbd5e1;
  white-space: nowrap;
}

.dslc-header .actions{
  display: flex;
  gap: 6px;
}

.dslc-header button{
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  cursor: pointer;
}

.dslc-header #dslc-close{
  font-size: 20px;
  line-height: 1;
}

.dslc-messages{
  padding: 16px;
  background: var(--dslc-surface);
  overflow: auto;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-gutter: stable;
}

.dslc-msg{
  display: flex;
}

.dslc-msg.me{
  justify-content: flex-end;
}

.dslc-b{
  max-width: min(84%, 560px);
  background: #fff;
  border: 1px solid var(--dslc-border);
  padding: 12px 14px;
  border-radius: 16px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
  color: #0f172a;
  font-size: 14px;
}

.dslc-b.muted{
  color: #475569;
}

.dslc-msg.me .dslc-b{
  background: #eff6ff;
  border-color: #bfdbfe;
}

.dslc-b .dslc-link,
.dslc-att .dslc-file-link{
  color: var(--dslc-accent-strong);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2px;
  background: rgba(37, 99, 235, 0.1);
  border-radius: 8px;
  padding: 0 4px;
}

.dslc-b .dslc-link:hover,
.dslc-att .dslc-file-link:hover{
  background: rgba(37, 99, 235, 0.16);
}

.dslc-sys{
  color: #475569;
  font-size: 12px;
  line-height: 1.45;
  background: #fff;
  border: 1px dashed #cbd5e1;
  padding: 10px 12px;
  border-radius: 14px;
}

.dslc-att{
  display: grid;
  gap: 8px;
}

.dslc-att img{
  max-width: min(100%, 260px);
  border-radius: 14px;
  display: block;
}

.dslc-loginwall{
  margin: 0 14px 12px;
  padding: 14px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 16px;
}

.dslc-loginwall .ttl{
  font-weight: 900;
  color: #9a3412;
  margin-bottom: 6px;
  font-size: 14px;
}

.dslc-loginwall .hint{
  color: #9a3412;
  font-size: 13px;
  margin-bottom: 10px;
  line-height: 1.45;
}

.dslc-loginwall .btn{
  display: inline-block;
  background: #fb923c;
  color: #fff;
  text-decoration: none;
  font-weight: 900;
  padding: 11px 14px;
  border-radius: 12px;
}

.dslc-callback{
  margin: 0 14px 12px;
  border: 1px solid var(--dslc-border);
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
}

.dslc-callback summary{
  list-style: none;
  cursor: pointer;
  padding: 12px 14px;
  font-weight: 800;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dslc-callback summary::-webkit-details-marker{ display: none; }

.dslc-callback .body{
  padding: 0 14px 14px;
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.dslc-callback label{
  flex: 1;
  min-width: 180px;
}

.dslc-callback label span{
  display: block;
  font-size: 12px;
  color: #475569;
  margin-bottom: 6px;
}

.dslc-callback input,
#dslc-input{
  width: 100%;
  border: 1px solid var(--dslc-border);
  border-radius: 14px;
  font-size: 16px;
  line-height: 1.4;
  background: #fff;
}

.dslc-callback input{
  min-height: 46px;
  padding: 11px 12px;
}

.dslc-callback .btn,
#dslc-send{
  border: 0;
  background: linear-gradient(135deg, var(--dslc-accent), var(--dslc-accent-strong));
  color: #fff;
  font-weight: 800;
  border-radius: 14px;
  cursor: pointer;
}

.dslc-callback .btn{
  min-height: 46px;
  padding: 0 16px;
}

.dslc-callback .info{
  flex-basis: 100%;
  font-size: 12px;
  color: #16a34a;
}

.dslc-contacts{
  margin: 0 14px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.dslc-contacts .ttl{
  font-size: 12px;
  color: #475569;
  font-weight: 700;
  margin-right: auto;
}

.dslc-contacts .c{
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f172a;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
}

#dslc-form{
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  background: #fff;
  border-top: 1px solid var(--dslc-border);
}

#dslc-form.disabled{
  opacity: .6;
  pointer-events: none;
}

#dslc-attach,
#dslc-send{
  min-height: 46px;
}

#dslc-attach{
  width: 44px;
  border: 1px solid var(--dslc-border);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
}

#dslc-input{
  resize: none;
  padding: 11px 12px;
  min-height: 46px;
  max-height: 180px;
}

#dslc-send{
  min-width: 88px;
  padding: 0 16px;
}

#dslc-toast{
  position: fixed;
  right: 20px;
  bottom: calc(20px + var(--dslc-offset) + var(--dslc-bubble-size) + var(--dslc-gap) + 8px + env(safe-area-inset-bottom));
  background: rgba(15, 23, 42, 0.96);
  color: #fff;
  padding: 11px 13px;
  border-radius: 14px;
  box-shadow: var(--dslc-shadow);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .2s ease, transform .2s ease;
  z-index: 99999;
  max-width: min(360px, calc(100vw - 40px));
  cursor: pointer;
}

#dslc-toast.show{
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 640px){
  #dslc-widget{
    right: 12px;
  }

  #dslc-panel{
    right: 12px;
    width: calc(100vw - 24px);
    top: auto;
    bottom: calc(var(--dslc-bot) + var(--dslc-offset) + var(--dslc-bubble-size) + 6px + env(safe-area-inset-bottom));
    max-height: calc(100dvh - env(safe-area-inset-top) - (var(--dslc-bot) + var(--dslc-offset) + var(--dslc-bubble-size) + 18px + env(safe-area-inset-bottom)));
    min-height: 0;
    height: auto;
  }

  .dslc-header{
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .dslc-header .brand{
    min-width: 140px;
  }

  .dslc-header .actions{
    margin-left: auto;
  }

  .dslc-b{
    max-width: 90%;
  }

  #dslc-form{
    grid-template-columns: 44px minmax(0, 1fr);
  }

  #dslc-send{
    grid-column: 1 / -1;
    width: 100%;
  }

  #dslc-toast{
    right: 12px;
    max-width: calc(100vw - 24px);
  }
}

@media (min-width: 1280px){
  #dslc-panel{
    width: min(500px, calc(100vw - 48px));
  }

  .dslc-b{
    max-width: 74%;
    font-size: 15px;
  }
}
