/* Inline per-character decoration controls inside the text composer. */
.td-composer-toolbar {
  justify-content: space-between;
}

.td-composer-toolbar-left,
.td-composer-toolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.td-composer-toolbar-right {
  margin-left: auto;
}

.td-composer-cell-mode {
  display: grid;
  padding: 0;
}

.td-composer-cell-mode .td-grid-panel-inline {
  min-width: 0;
  padding: 12px 12px 0;
}

.td-composer-cell-mode .td-grid-wrap {
  max-height: calc(32px + (48px * 4) + (6px * 4) + 8px);
  overflow-x: auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.td-composer-cell-mode .td-composer-toolbar {
  margin-top: 12px;
}

.td-cell-panel-header {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) 34px;
  gap: 12px;
  align-items: center;
  min-height: 56px;
}

.td-panel .td-cell-panel-title {
  display: inline-flex;
  align-self: center;
  align-items: center;
  height: 34px;
  margin: 0;
  color: #2f2930;
  font-size: 15px;
  font-weight: 900;
  line-height: 34px;
  white-space: nowrap;
}

.td-cell-panel-selected {
  display: flex;
  align-self: center;
  justify-self: start;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 28px;
  border-radius: 999px;
  background: #f5f8fc;
  color: #556170;
  padding: 0 11px;
  font-size: 12px;
  line-height: 1;
}

.td-cell-panel-selected-label {
  flex: 0 0 auto;
  color: #728091;
  font-weight: 700;
}

.td-cell-panel-selected strong {
  color: #263241;
  font-weight: 900;
  line-height: 1;
}

.td-cell-panel-close {
  appearance: none;
  display: grid;
  align-self: center;
  grid-column: 4;
  justify-self: end;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: #f7eef3;
  color: #7a6670;
  cursor: pointer;
  font-size: 22px;
  font-weight: 500;
  line-height: 1;
  place-items: center;
}

.td-cell-panel-close:hover,
.td-cell-panel-close:focus-visible {
  background: #f1dfe8;
  color: #8f2c55;
}

.td-composer-mode-button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 114px;
  height: 34px;
  border: 1px solid #d9c4cd;
  border-radius: 7px;
  background: #fff;
  color: #8f2c55;
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease;
}

.td-composer-mode-button:hover,
.td-composer-mode-button:focus-visible {
  border-color: #bd4a78;
  background: #fff6fa;
  color: #7f2449;
}

.td-composer-mode-select {
  border-color: #bd4a78;
  background: #bd4a78;
  color: #fff;
  box-shadow: 0 6px 14px rgba(189, 74, 120, .14);
}

.td-composer-mode-select:hover,
.td-composer-mode-select:focus-visible {
  background: #a63c67;
  color: #fff;
}

.td-composer-mode-back {
  min-width: 104px;
}

.td-composer-mode-icon {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
}

.td-composer-mode-label {
  font-weight: 900;
}

.td-grid-panel-inline .td-grid {
  gap: 6px;
}

.td-grid-panel-inline .td-grid-row {
  grid-auto-columns: 48px;
  gap: 6px;
}

.td-grid-panel-inline .td-grid-corner,
.td-grid-panel-inline .td-column-label,
.td-grid-panel-inline .td-row-label,
.td-grid-panel-inline .td-cell {
  width: 48px;
  height: 48px;
}

.td-grid-panel-inline .td-grid-header-row .td-grid-corner,
.td-grid-panel-inline .td-column-label {
  height: 32px;
}

.td-grid-panel-inline .td-cell {
  border-radius: 7px;
}

.td-grid-panel-inline .td-cell-char {
  font-size: 22px;
}

.td-grid-panel-inline .td-cell-asset {
  width: 32px;
  height: 32px;
}

.td-grid-panel-inline .td-cell-icon {
  width: 28px;
  height: 28px;
}

.td-grid-panel-inline .td-cell-badge {
  right: 6px;
  bottom: 6px;
}

@media (max-width: 1180px) {
  .td-app.is-mobile-panel-input .td-text-action-buttons {
    grid-template-columns: repeat(2, minmax(0, max-content));
    gap: 8px;
  }

  .td-app.is-mobile-panel-input .td-text-action-buttons .td-composer-mode-button {
    width: 100%;
    height: 40px;
    border: 1px solid #eadde3;
    border-radius: 10px;
    background: #fffafc;
    color: #8f2c55;
    box-shadow: none;
    white-space: nowrap;
  }

  .td-app.is-mobile-panel-input .td-text-action-buttons .td-composer-mode-select {
    min-width: 112px;
    height: 40px;
    padding: 0 12px;
    border-color: #eadde3;
    background: #fffafc;
    color: #8f2c55;
  }

  .td-app.is-mobile-panel-input.is-cell-decoration-mode {
    --td-compact-controls-open-height: min(380px, 42vh);
    --td-compact-controls-height: var(--td-compact-controls-open-height);
  }

  .td-app.is-mobile-panel-input.is-cell-decoration-mode.is-mobile-bottom-nav-hidden {
    --td-compact-controls-open-height: min(380px, 42vh);
  }

  .td-app.is-cell-decoration-mode:not(.is-mobile-input-overlay-style):not(.is-mobile-input-overlay-decoration):not(.is-mobile-input-overlay-position) .td-mobile-sheet-head,
  .td-app.is-cell-decoration-mode .td-part-tabs-shell,
  .td-app.is-cell-decoration-mode .td-add-menu {
    display: none !important;
  }

  .td-app.is-cell-decoration-mode .td-controls-column {
    border-top: 1px solid #eee4e8 !important;
    background: #fff !important;
  }

  .td-app.is-cell-decoration-mode .td-text-panel {
    padding-top: 0 !important;
  }

  .td-app.is-mobile-panel-input:not(.is-mobile-input-focused) .td-text-panel.is-cell-decoration-mode {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    min-width: 0 !important;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .td-app.is-mobile-panel-input:not(.is-mobile-input-focused) .td-text-panel.is-cell-decoration-mode::-webkit-scrollbar {
    width: 0;
    height: 0;
  }

  .td-app.is-mobile-panel-input:not(.is-mobile-input-focused) .td-text-panel.is-cell-decoration-mode > .td-composer-cell-mode {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    min-width: 0 !important;
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .td-app.is-mobile-panel-input:not(.is-mobile-input-focused) .td-text-panel.is-cell-decoration-mode .td-grid-panel-inline {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    min-width: 0 !important;
    height: auto;
    min-height: 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
    padding: 0 12px 12px;
  }

  .td-app.is-mobile-panel-input:not(.is-mobile-input-focused) .td-text-panel.is-cell-decoration-mode .td-cell-panel-header {
    position: sticky;
    top: 0;
    z-index: 4;
    margin: 0 -12px 12px;
    padding: 7px 5px 7px 12px;
    border-bottom: 1px solid #eee4e8;
    background: #fff;
    box-shadow: 0 4px 0 #fff;
  }

  .td-app.is-mobile-panel-input:not(.is-mobile-input-focused) .td-text-panel.is-cell-decoration-mode .td-cell-toolbar {
    display: flex;
    flex-wrap: nowrap;
    width: max-content;
    max-width: 100%;
    gap: 6px;
    margin: 0 0 12px;
    overflow-x: auto;
    padding-bottom: 1px;
  }

  .td-app.is-mobile-panel-input:not(.is-mobile-input-focused) .td-text-panel.is-cell-decoration-mode .td-cell-toolbar .td-button {
    flex: 0 0 auto;
    min-height: 32px;
    padding: 6px 13px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1.1;
  }

  .td-app.is-mobile-panel-input:not(.is-mobile-input-focused) .td-text-panel.is-cell-decoration-mode .td-grid-wrap {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    min-width: 0 !important;
    width: max-content !important;
    min-height: 0;
    max-height: none;
    overflow-x: scroll !important;
    overflow-y: hidden !important;
    overscroll-behavior-x: contain;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: rgba(116, 128, 145, .78) rgba(223, 228, 235, .9);
    padding: 1px 0 3px;
    -webkit-overflow-scrolling: touch;
  }

  .td-app.is-mobile-panel-input:not(.is-mobile-input-focused) .td-text-panel.is-cell-decoration-mode .td-grid-panel-inline .td-grid {
    gap: 5px;
  }

  .td-app.is-mobile-panel-input:not(.is-mobile-input-focused) .td-text-panel.is-cell-decoration-mode .td-grid-panel-inline .td-grid-row {
    grid-auto-columns: 44px;
    gap: 5px;
  }

  .td-app.is-mobile-panel-input:not(.is-mobile-input-focused) .td-text-panel.is-cell-decoration-mode .td-grid-panel-inline .td-grid-corner,
  .td-app.is-mobile-panel-input:not(.is-mobile-input-focused) .td-text-panel.is-cell-decoration-mode .td-grid-panel-inline .td-column-label,
  .td-app.is-mobile-panel-input:not(.is-mobile-input-focused) .td-text-panel.is-cell-decoration-mode .td-grid-panel-inline .td-row-label,
  .td-app.is-mobile-panel-input:not(.is-mobile-input-focused) .td-text-panel.is-cell-decoration-mode .td-grid-panel-inline .td-cell {
    width: 44px;
    height: 44px;
  }

  .td-app.is-mobile-panel-input:not(.is-mobile-input-focused) .td-text-panel.is-cell-decoration-mode .td-grid-panel-inline .td-grid-header-row .td-grid-corner,
  .td-app.is-mobile-panel-input:not(.is-mobile-input-focused) .td-text-panel.is-cell-decoration-mode .td-grid-panel-inline .td-column-label {
    height: 26px;
  }

  .td-app.is-mobile-panel-input:not(.is-mobile-input-focused) .td-text-panel.is-cell-decoration-mode .td-grid-panel-inline .td-cell-char {
    font-size: 20px;
  }

  .td-mobile-bottom-nav.is-cell-decoration-menu .td-mobile-bottom-item:disabled {
    cursor: default;
    opacity: .42;
  }

  .td-mobile-bottom-nav.is-cell-decoration-menu .td-mobile-bottom-item:disabled .td-mobile-bottom-icon,
  .td-mobile-bottom-nav.is-cell-decoration-menu .td-mobile-bottom-item:disabled .td-mobile-bottom-label {
    opacity: .72;
  }

  .td-app.is-mobile-panel-input:not(.is-mobile-input-focused) .td-text-panel.is-cell-decoration-mode .td-grid-wrap::-webkit-scrollbar {
    width: 12px;
    height: 10px;
  }

  .td-app.is-mobile-panel-input:not(.is-mobile-input-focused) .td-text-panel.is-cell-decoration-mode .td-grid-wrap::-webkit-scrollbar-track {
    background: rgba(223, 228, 235, .9);
    border-radius: 999px;
  }

  .td-app.is-mobile-panel-input:not(.is-mobile-input-focused) .td-text-panel.is-cell-decoration-mode .td-grid-wrap::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(116, 128, 145, .78);
  }

  .td-app.is-mobile-panel-input.is-mobile-input-focused:not(.is-mobile-input-overlay-style):not(.is-mobile-input-overlay-decoration):not(.is-mobile-input-overlay-position) .td-mobile-input-tools .td-composer-mode-button {
    width: 36px;
    min-width: 36px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: #f8f6f7;
    color: #6b5d64;
    box-shadow: none;
  }

  .td-app.is-mobile-panel-input.is-mobile-input-focused:not(.is-mobile-input-overlay-style):not(.is-mobile-input-overlay-decoration):not(.is-mobile-input-overlay-position) .td-mobile-input-tools .td-composer-mode-label {
    display: none;
  }

  .td-app.is-mobile-panel-input.is-mobile-input-focused:not(.is-mobile-input-overlay-style):not(.is-mobile-input-overlay-decoration):not(.is-mobile-input-overlay-position) .td-mobile-input-tools .td-composer-mode-button:active {
    background: #f3e7ed;
    color: #9f315b;
  }

  .td-app.is-mobile-panel-input.is-mobile-input-focused:not(.is-mobile-input-overlay-style):not(.is-mobile-input-overlay-decoration):not(.is-mobile-input-overlay-position) .td-mobile-input-composer.td-composer-cell-mode {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
    padding: 8px;
  }

  .td-app.is-mobile-panel-input.is-mobile-input-focused:not(.is-mobile-input-overlay-style):not(.is-mobile-input-overlay-decoration):not(.is-mobile-input-overlay-position) .td-mobile-input-composer.td-composer-cell-mode .td-grid-panel-inline {
    min-width: 0;
    padding: 0;
  }

  .td-app.is-mobile-panel-input.is-mobile-input-focused:not(.is-mobile-input-overlay-style):not(.is-mobile-input-overlay-decoration):not(.is-mobile-input-overlay-position) .td-mobile-input-composer.td-composer-cell-mode .td-panel-header {
    display: none;
  }

  .td-app.is-mobile-panel-input.is-mobile-input-focused:not(.is-mobile-input-overlay-style):not(.is-mobile-input-overlay-decoration):not(.is-mobile-input-overlay-position) .td-mobile-input-composer.td-composer-cell-mode .td-cell-toolbar {
    flex-wrap: nowrap;
    margin-bottom: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .td-app.is-mobile-panel-input.is-mobile-input-focused:not(.is-mobile-input-overlay-style):not(.is-mobile-input-overlay-decoration):not(.is-mobile-input-overlay-position) .td-mobile-input-composer.td-composer-cell-mode .td-grid-wrap {
    max-height: 142px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
}
