/* Layout for the lmrepair viewtopic template and its existing controls. */
.section-viewtopic .action-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-block: 12px;
}

.section-viewtopic .action-bar::before,
.section-viewtopic .action-bar::after {
  content: none;
}

.section-viewtopic .action-bar > .button,
.section-viewtopic .action-bar > .dropdown-button-control,
.section-viewtopic .action-bar > .pagination,
.section-viewtopic .action-bar > .search-box {
  float: none;
  margin: 0;
  min-width: 0;
  max-width: 100%;
}

.section-viewtopic .action-bar > .button,
.section-viewtopic .action-bar > .dropdown-button-control > .button,
.section-viewtopic #topic-search .button,
.section-viewtopic .post-buttons .button {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  float: none;
  margin: 0;
  min-height: 36px;
  padding: 5px 10px;
  line-height: 1.35;
}

.section-viewtopic .action-bar .caret {
  position: static;
  padding-inline-start: 4px;
}

.section-viewtopic .action-bar > .pagination {
  margin-inline-start: auto;
  overflow-wrap: anywhere;
}

.section-viewtopic .action-bar > .search-box {
  flex: 1 1 245px;
  max-width: 355px;
}

.section-viewtopic #topic-search fieldset {
  display: flex;
  align-items: stretch;
  gap: 4px;
  min-width: 0;
  margin: 0;
  padding: 0;
}

.section-viewtopic #topic-search .inputbox {
  box-sizing: border-box;
  flex: 1 1 0;
  float: none;
  height: auto;
  width: auto;
  min-width: 0;
  max-width: none;
  margin: 0;
  border: 1px solid var(--lm-line);
  border-radius: 10px;
  padding: 5px 9px;
}

.section-viewtopic #topic-search .button {
  flex: 0 0 36px;
  padding-inline: 0;
}

/* Extension output inserted at the end of the action bar needs a full row. */
.section-viewtopic .action-bar > :has(#mydc-cf-case-open) {
  flex: 0 0 100%;
  box-sizing: border-box;
  min-width: 0;
}

.section-viewtopic #mydc-cf-case-open {
  box-sizing: border-box;
  float: none;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* The two original floated widths cannot share a line after padding is added. */
.section-viewtopic .post.has-profile {
  overflow: visible;
}

.section-viewtopic .post.has-profile > .inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
}

.section-viewtopic .post.has-profile > .inner::before,
.section-viewtopic .post.has-profile > .inner::after {
  content: none;
}

.section-viewtopic .post.has-profile > .inner > .postbody,
.section-viewtopic .post.has-profile > .inner > .postprofile {
  box-sizing: border-box;
  float: none;
  width: auto;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.section-viewtopic .post.has-profile > .inner > .postbody {
  flex: 1 1 0;
  order: -1;
  padding: 18px 20px 16px;
}

.section-viewtopic .post.has-profile > .inner > .postprofile {
  flex: 0 0 clamp(160px, 21%, 224px);
  margin: 0;
  padding: 16px;
  border-radius: 0;
  border-start-end-radius: 23px;
}

.section-viewtopic .post.has-profile > .inner > .back2top {
  flex: 0 0 100%;
  box-sizing: border-box;
  padding: 0 18px 12px;
}

.section-viewtopic .postbody > [id^="post_content"] > h3 {
  margin-inline: 0;
  font-size: clamp(17px, 2.3vw, 23px);
}

.section-viewtopic .post.has-profile .post-buttons {
  position: relative;
  inset: auto;
  float: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
  margin: 4px 0 8px;
}

.section-viewtopic .post-buttons > li {
  float: none;
  margin: 0;
}

.section-viewtopic .post-buttons .button {
  min-width: 34px;
  padding-inline: 6px;
}

.section-viewtopic .post-buttons .dropdown {
  top: 100%;
}

.section-viewtopic .topic-title,
.section-viewtopic .lm-case-summary > div {
  min-width: 0;
  overflow-wrap: anywhere;
}

.section-viewtopic .postbody :is(.attachbox, .attach-image, img, video, iframe) {
  box-sizing: border-box;
  max-width: 100%;
}

@media (max-width: 700px) {
  .section-viewtopic .action-bar > .search-box {
    flex-basis: 100%;
    max-width: none;
  }

  .section-viewtopic .action-bar > .pagination {
    flex-basis: 100%;
    margin-inline-start: 0;
    text-align: start;
  }

  .section-viewtopic .action-bar > .button,
  .section-viewtopic .action-bar > .dropdown-button-control > .button,
  .section-viewtopic #topic-search .button,
  .section-viewtopic .post-buttons .button,
  .section-viewtopic #mydc-cf-case-open {
    min-width: 44px;
    min-height: 44px;
  }

  .section-viewtopic #topic-search .inputbox {
    font-size: 16px;
  }

  .section-viewtopic :has(> #mydc-cf-case-open) {
    flex-wrap: wrap;
  }

  .section-viewtopic #mydc-cf-case-open {
    width: 100%;
    margin-inline: 0;
  }

  .section-viewtopic .post.has-profile > .inner > .postbody {
    flex: 0 0 100%;
    order: 0;
    padding: 12px 14px 16px;
  }

  .section-viewtopic .post.has-profile > .inner > .postprofile {
    flex: 0 0 100%;
    min-height: 0;
    padding: 10px 14px;
    border-radius: 23px 23px 0 0;
  }

  .section-viewtopic .post.has-profile > .inner > .back2top {
    padding-inline: 14px;
  }

  .section-viewtopic .lm-case-summary {
    flex-wrap: wrap;
  }

  .section-viewtopic .lm-case-summary .lm-case-actions {
    align-items: center;
    flex-direction: row;
    flex-wrap: wrap;
  }
}
