/* richlive-v1
 * Live (WYSIWYG) composer. The textarea stays as the markdown source;
 * .rt-live is what the user types into. Bullets are a center dot in the
 * composer and in sent messages.
 */

/* Hide the source textarea and the mention overlay; mentions render in the editor. */
.comp-hlwrap.rt-live-on textarea.rt-live-src{
  position:absolute;
  width:1px;
  height:1px;
  padding:0 !important;
  margin:0;
  border:0;
  opacity:0;
  overflow:hidden;
  pointer-events:none;
  clip:rect(0 0 0 0);
  clip-path:inset(50%);
  z-index:-1;
}
.comp-hlwrap.rt-live-on .comp-hl{display:none !important}

.rt-live{
  flex:1 1 auto;
  width:100%;
  min-width:0;
  min-height:32px;
  max-height:180px;
  overflow-x:hidden;
  overflow-y:auto;
  outline:0;
  padding:6px 8px;
  margin:0;
  box-sizing:border-box;
  font:inherit;
  font-size:14px;
  line-height:1.4;
  color:var(--txt);
  background:transparent;
  white-space:pre-wrap;
  overflow-wrap:anywhere;
  word-wrap:break-word;
  -webkit-user-select:text;
  user-select:text;
}
.rt-live:focus{outline:0}
.rt-live.rt-empty:before{
  content:attr(data-placeholder);
  color:#8a95a1;
  pointer-events:none;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.rt-live b,.rt-live strong{font-weight:700}
.rt-live i,.rt-live em{font-style:italic}
.rt-live s,.rt-live strike,.rt-live del{text-decoration:line-through}
.rt-live code{
  background:#f1f4f7;
  border-radius:4px;
  padding:0 4px;
  font-family:ui-monospace,SFMono-Regular,Menlo,monospace;
  font-size:0.92em;
}
.rt-live pre{
  background:#f6f8fa;
  border:1px solid var(--line, #e6e9ee);
  border-radius:6px;
  padding:8px 10px;
  overflow:auto;
  font-family:ui-monospace,SFMono-Regular,Menlo,monospace;
  font-size:12.5px;
  margin:4px 0;
  white-space:pre-wrap;
}
.rt-live pre code{background:transparent;padding:0;font-size:inherit}
.rt-live blockquote{
  margin:4px 0;
  padding:2px 0 2px 10px;
  border-left:4px solid #d0d7de;
  color:#1d1c1d;
}
.rt-live ul,.rt-live ol{margin:2px 0 4px;padding-left:1.35em}
.rt-live a{color:#1264a3;text-decoration:underline}
.rt-live .mention{background:#e4f0fb;color:#1264a3;border-radius:3px;padding:0;font-weight:inherit}

/* Center-dot bullets in the composer and in sent / search / activity text. */
.rt-live ul,
.txt ul,
.sx-version ul,
.act-sum ul{
  list-style:none;
  padding-left:1.35em;
}
.rt-live ul li,
.txt ul li,
.sx-version ul li,
.act-sum ul li{
  position:relative;
}
.rt-live ul li::before,
.txt ul li::before,
.sx-version ul li::before,
.act-sum ul li::before{
  content:"\2022";
  position:absolute;
  left:-1.15em;
  width:1.15em;
  text-align:center;
  font-weight:700;
  color:inherit;
  speak:none;
}
.rt-live ul li::marker,
.txt ul li::marker,
.sx-version ul li::marker,
.act-sum ul li::marker{
  content:"";
}

.rt-btn.rt-on,
.rt-btn[aria-pressed="true"]{
  background:#e8f1f8;
  color:#1264a3;
}
.rt-acol.rt-c-red{border-bottom-color:#e11d48;color:#e11d48}
.rt-acol.rt-c-orange{border-bottom-color:#d97706;color:#d97706}
.rt-acol.rt-c-green{border-bottom-color:#159947;color:#159947}
.rt-acol.rt-c-blue{border-bottom-color:#1264a3;color:#1264a3}
.rt-acol.rt-c-purple{border-bottom-color:#7c3aed;color:#7c3aed}
.rt-acol.rt-c-gray{border-bottom-color:#64748b;color:#64748b}

/* Edit-message modal */
.comp.rt-edit .rt-live{
  min-height:120px;
  max-height:240px;
  padding:8px 10px;
  font:inherit;
}

@media (max-width:700px){
  :where(html:not(.nc-tablet)) .rt-live{
    font-family:inherit !important;
    font-size:16px !important;
    font-weight:400 !important;
    line-height:20px !important;
    letter-spacing:normal !important;
    padding:6px 8px !important;
    margin:0 !important;
    min-height:32px !important;
    max-height:180px;
    box-sizing:border-box !important;
  }
}


/* richlive-v2: keep the action bar and format toolbar above the keyboard,
   and show the format bar whenever the composer is focused. */
.rt-live{
  scroll-margin-bottom:56px;
}
@media (max-width:700px){
  :where(html:not(.nc-tablet)) .rt-live{
    scroll-margin-bottom:56px;
  }
  :where(html:not(.nc-tablet)) .comp.nc-comp-focus .comp-tools,
  :where(html:not(.nc-tablet)) .comp:focus-within .comp-tools,
  html:where(:not(.nc-tablet)).nc-kb-open #compMain .comp-tools,
  html:where(:not(.nc-tablet)).nc-kb-open #thread.on #compThread .comp-tools{
    display:flex !important;
  }
  :where(html:not(.nc-tablet)) .comp.nc-comp-focus .rt-bar,
  :where(html:not(.nc-tablet)) .comp.rt-open .rt-bar,
  :where(html:not(.nc-tablet)) .comp.rt-edit .rt-bar,
  html:where(:not(.nc-tablet)).nc-kb-open #compMain.rt-ready .rt-bar,
  html:where(:not(.nc-tablet)).nc-kb-open #thread.on #compThread.rt-ready .rt-bar{
    display:flex !important;
  }
}

/* Full color palette popover */
.rt-colors.rt-palette{
  display:flex;
  flex-direction:column;
  gap:8px;
  box-sizing:border-box;
  padding:10px;
  width:min(320px, calc(100vw - 16px));
  max-width:calc(100vw - 16px);
  max-height:min(42vh, 280px);
  overflow:auto;
  -webkit-overflow-scrolling:touch;
  left:auto;
  right:0;
}
.rt-pal-label{
  font-size:11px;
  font-weight:600;
  letter-spacing:.02em;
  color:#6b7280;
  text-transform:uppercase;
}
.rt-pal-grid{
  display:grid;
  grid-template-columns:repeat(8, 1fr);
  gap:6px;
}
.rt-pal-row{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
}
.rt-palette .rt-swatch{
  width:22px;
  height:22px;
  border-radius:4px;
  border:1px solid rgba(0,0,0,.18);
  padding:0;
  cursor:pointer;
  box-sizing:border-box;
}
.rt-palette .rt-swatch.rt-swatch-clear{
  width:auto;
  height:24px;
  padding:0 8px;
  background:#fff;
  font-size:11px;
  color:#374151;
  border-radius:4px;
}
.rt-pal-custom{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  padding-top:4px;
  border-top:1px solid #e5e7eb;
}
.rt-pal-picker-wrap{
  display:flex;
  align-items:center;
  gap:8px;
  font-size:12px;
  color:#374151;
  cursor:pointer;
}
.rt-pal-picker{
  width:28px;
  height:24px;
  padding:0;
  border:1px solid #d1d5db;
  border-radius:4px;
  background:transparent;
  cursor:pointer;
}
@media (max-width:700px){
  :where(html:not(.nc-tablet)) .rt-colors.rt-palette{
    width:min(300px, calc(100vw - 12px));
    max-height:min(36vh, 240px);
    bottom:100%;
    top:auto;
    margin-bottom:6px;
  }
}

/* tablet2b-v1: phone rules scoped to html:not(.nc-tablet); iPad windows >= 600px keep the tablet layout */
