/* TungstenCloud add-on integration layer v2.1.8.
 * Loaded after every add-on's own stylesheet. It keeps the add-on's Vue logic
 * intact while normalising the four client-area add-on families. */

html[theme="tungstencloud"][data-tc-plugin="true"] {
  --tc-addon-max: 1440px;
  --tc-addon-gap: 20px;
}

html[theme="tungstencloud"][data-tc-plugin="true"] body,
html[theme="tungstencloud"][data-tc-plugin="true"] .template,
html[theme="tungstencloud"][data-tc-plugin="true"] .template > .el-container {
  min-height: 100vh !important;
}

html[theme="tungstencloud"][data-tc-plugin="true"] .top-back,
html[theme="tungstencloud"][data-tc-plugin="true"] .back-img {
  display: none !important;
}

html[theme="tungstencloud"][data-tc-plugin="true"] .el-main {
  min-height: 0 !important;
  overflow: visible !important;
}

html[theme="tungstencloud"][data-tc-plugin="true"] .el-main > *,
html[theme="tungstencloud"][data-tc-plugin="true"] .main-card,
html[theme="tungstencloud"][data-tc-plugin="true"] .clid-box,
html[theme="tungstencloud"][data-tc-plugin="true"] .recommend-box,
html[theme="tungstencloud"][data-tc-plugin="true"] .recommend-box-open,
html[theme="tungstencloud"][data-tc-plugin="true"] .recommend-content {
  box-sizing: border-box !important;
  min-height: 0 !important;
  height: auto !important;
}

html[theme="tungstencloud"][data-tc-plugin="true"] .el-main > .main-card,
html[theme="tungstencloud"][data-tc-plugin="true"] .el-main > .clid-box,
html[theme="tungstencloud"][data-tc-plugin="true"] .el-main > .recommend-box,
html[theme="tungstencloud"][data-tc-plugin="true"] .el-main > .recommend-box-open,
html[theme="tungstencloud"][data-tc-plugin="true"] .el-main > .recommend-content {
  width: min(100%, var(--tc-addon-max)) !important;
  margin: 0 auto !important;
}

html[theme="tungstencloud"][data-tc-plugin="true"] .el-tabs__header {
  margin: 0 0 22px !important;
}

html[theme="tungstencloud"][data-tc-plugin="true"] .el-tabs__nav-wrap::after {
  height: 1px !important;
  background: var(--tc-line) !important;
}

html[theme="tungstencloud"][data-tc-plugin="true"] .el-tabs__item {
  height: 44px !important;
  padding: 0 22px !important;
  color: var(--tc-muted) !important;
  font-size: 14px !important;
  line-height: 44px !important;
}

html[theme="tungstencloud"][data-tc-plugin="true"] .el-tabs__item.is-active {
  color: var(--color-primary) !important;
  font-weight: 650 !important;
}

html[theme="tungstencloud"][data-tc-plugin="true"] .el-tabs__active-bar {
  height: 2px !important;
}

html[theme="tungstencloud"][data-tc-plugin="true"] .el-table::before,
html[theme="tungstencloud"][data-tc-plugin="true"] .el-table__fixed::before,
html[theme="tungstencloud"][data-tc-plugin="true"] .el-table__fixed-right::before {
  background: var(--tc-line) !important;
}

html[theme="tungstencloud"][data-tc-plugin="true"] .el-pagination {
  display: flex !important;
  flex-wrap: wrap !important;
  justify-content: flex-end !important;
  gap: 4px !important;
  margin-top: 18px !important;
}

/* Resource centre: help, news and file download share source.htm. */
html[theme="tungstencloud"][data-tc-page="source"] .main-card {
  position: relative !important;
  padding: 28px 30px 32px !important;
}

html[theme="tungstencloud"][data-tc-page="source"] .main-card > .main-card-title {
  margin-bottom: 18px !important;
}

html[theme="tungstencloud"][data-tc-page="source"] .search-input {
  width: min(360px, 100%) !important;
  margin: 0 0 24px !important;
}

html[theme="tungstencloud"][data-tc-page="source"] .main-card-top {
  margin: 0 !important;
  padding: 0 !important;
}

html[theme="tungstencloud"][data-tc-page="source"] .main-card-top .top-menu {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 24px !important;
  margin: 0 0 22px !important;
  padding: 0 !important;
  border-bottom: 1px solid var(--tc-line) !important;
  list-style: none !important;
}

html[theme="tungstencloud"][data-tc-page="source"] .main-card-top .top-menu-item {
  margin: 0 !important;
  padding: 0 0 12px !important;
  color: var(--tc-muted) !important;
  cursor: pointer !important;
}

html[theme="tungstencloud"][data-tc-page="source"] .main-card-top .top-menu-item-active {
  border-bottom: 2px solid var(--color-primary) !important;
  color: var(--color-primary) !important;
}

html[theme="tungstencloud"][data-tc-page="source"] .main-card-content {
  min-height: 180px !important;
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 18px !important;
  padding: 0 !important;
}

html[theme="tungstencloud"][data-tc-page="source"] .content-item {
  position: relative !important;
  width: auto !important;
  min-width: 0 !important;
  min-height: 190px !important;
  margin: 0 !important;
  padding: 20px !important;
  border: 1px solid var(--tc-line) !important;
  border-radius: 14px !important;
  background: var(--tc-surface-2) !important;
  box-shadow: none !important;
}

html[theme="tungstencloud"][data-tc-page="source"] .content-item-title {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  margin-bottom: 14px !important;
  color: var(--tc-text) !important;
  font-size: 16px !important;
  font-weight: 650 !important;
}

html[theme="tungstencloud"][data-tc-page="source"] .content-item-title img {
  width: 32px !important;
  height: 32px !important;
  object-fit: contain !important;
}

html[theme="tungstencloud"][data-tc-page="source"] .content-item-link {
  display: grid !important;
  gap: 8px !important;
}

html[theme="tungstencloud"][data-tc-page="source"] .link-item {
  min-width: 0 !important;
  overflow: hidden !important;
  color: var(--tc-muted) !important;
  line-height: 1.6 !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  cursor: pointer !important;
}

html[theme="tungstencloud"][data-tc-page="source"] .more-btn {
  position: static !important;
  display: inline-flex !important;
  width: auto !important;
  margin-top: 14px !important;
  color: var(--color-primary) !important;
  cursor: pointer !important;
}

html[theme="tungstencloud"][data-tc-page="source"] .box.pc {
  min-height: 0 !important;
  display: grid !important;
  grid-template-columns: 260px minmax(0, 1fr) !important;
  align-items: start !important;
  gap: 20px !important;
  margin: 0 !important;
}

html[theme="tungstencloud"][data-tc-page="source"] .box.mobile {
  display: none !important;
}

html[theme="tungstencloud"][data-tc-page="source"] .com-r-box,
html[theme="tungstencloud"][data-tc-page="source"] .com-l-box {
  float: none !important;
  width: auto !important;
  min-width: 0 !important;
  min-height: 180px !important;
  margin: 0 !important;
  padding: 20px !important;
  border: 1px solid var(--tc-line) !important;
  border-radius: 14px !important;
  background: var(--tc-surface-2) !important;
  box-shadow: none !important;
}

html[theme="tungstencloud"][data-tc-page="source"] .com-r-box .tit,
html[theme="tungstencloud"][data-tc-page="source"] .com-l-box .tit {
  margin: 0 0 14px !important;
  color: var(--tc-text) !important;
  font-size: 17px !important;
  font-weight: 650 !important;
}

html[theme="tungstencloud"][data-tc-page="source"] .com-r-box .item,
html[theme="tungstencloud"][data-tc-page="source"] .com-r-box .total {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  min-height: 38px !important;
  margin: 0 !important;
  padding: 8px 10px !important;
  border-radius: 8px !important;
  color: var(--tc-muted) !important;
  cursor: pointer !important;
}

html[theme="tungstencloud"][data-tc-page="source"] .com-r-box .item.active,
html[theme="tungstencloud"][data-tc-page="source"] .com-r-box .total.active {
  color: var(--color-primary) !important;
  background: color-mix(in srgb, var(--color-primary) 10%, transparent) !important;
}

html[theme="tungstencloud"][data-tc-page="source"] .news-list .item {
  min-height: 86px !important;
  display: grid !important;
  grid-template-columns: 112px minmax(0, 1fr) !important;
  gap: 16px !important;
  padding: 14px 0 !important;
}

html[theme="tungstencloud"][data-tc-page="source"] .news-list .item-img {
  width: 112px !important;
  height: 72px !important;
  border-radius: 9px !important;
  object-fit: cover !important;
}

html[theme="tungstencloud"][data-tc-page="source"] .no-data,
html[theme="tungstencloud"][data-tc-page="source"] .el-table__empty-block {
  min-height: 180px !important;
}

/* Ticket list and ticket editor. */
html[theme="tungstencloud"][data-tc-page="ticket"] .main-card {
  padding: 28px 30px 32px !important;
}

html[theme="tungstencloud"][data-tc-page="ticket"] .content_searchbar {
  min-height: 0 !important;
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) !important;
  align-items: center !important;
  gap: 18px !important;
  margin: 20px 0 !important;
}

html[theme="tungstencloud"][data-tc-page="ticket"] .new-ticket-btn {
  min-height: 42px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 18px !important;
  border-radius: 10px !important;
  color: #fff !important;
  background: var(--color-primary) !important;
  cursor: pointer !important;
  white-space: nowrap !important;
}

html[theme="tungstencloud"][data-tc-page="ticket"] .content_searchbar .searchbar {
  width: 100% !important;
  display: grid !important;
  grid-template-columns: repeat(3, minmax(170px, 1fr)) auto !important;
  gap: 12px !important;
  margin: 0 !important;
}

html[theme="tungstencloud"][data-tc-page="ticket"] .select-input,
html[theme="tungstencloud"][data-tc-page="ticket"] .select-input .el-input {
  width: 100% !important;
}

html[theme="tungstencloud"][data-tc-page="ticket"] .tabledata {
  min-height: 150px !important;
}

/* Child account list / editor. */
html[theme="tungstencloud"][data-tc-page="child-account"] .clid-box {
  padding: 28px 30px 32px !important;
}

html[theme="tungstencloud"][data-tc-page="child-account"] .clid-box > header {
  min-height: 0 !important;
}

html[theme="tungstencloud"][data-tc-page="child-account"] .clid-box .el-table {
  min-height: 150px !important;
}

/* Referral add-on: versions differ, so target stable semantic containers only. */
html[theme="tungstencloud"][data-tc-page="recommend"] .recommend-box,
html[theme="tungstencloud"][data-tc-page="recommend"] .recommend-box-open,
html[theme="tungstencloud"][data-tc-page="recommend"] .recommend-content,
html[theme="tungstencloud"][data-tc-page="recommend"] .main-card {
  width: min(100%, var(--tc-addon-max)) !important;
  margin: 0 auto !important;
  padding: 28px 30px 32px !important;
  border: 1px solid var(--tc-line) !important;
  border-radius: 18px !important;
  color: var(--tc-text) !important;
  background: var(--tc-surface) !important;
  box-shadow: var(--tc-shadow) !important;
}

html[theme="tungstencloud"][data-tc-page="recommend"] .recommend-box .recommend-content,
html[theme="tungstencloud"][data-tc-page="recommend"] .recommend-box-open .recommend-content {
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

html[theme="tungstencloud"][data-tc-page="recommend"] .top-statistic {
  min-height: 0 !important;
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 16px !important;
}

html[theme="tungstencloud"][data-tc-page="recommend"] .top-statistic .top-item {
  width: auto !important;
  min-width: 0 !important;
  min-height: 112px !important;
}

/* Forms shared by addTicket, ticketDetails, addChildAccount and referral setup. */
html[theme="tungstencloud"][data-tc-plugin="true"] .el-form {
  max-width: 100% !important;
}

html[theme="tungstencloud"][data-tc-plugin="true"] .el-form-item__content,
html[theme="tungstencloud"][data-tc-plugin="true"] .el-form-item__label {
  min-width: 0 !important;
}

html[theme="tungstencloud"][data-tc-plugin="true"] .el-dialog {
  max-width: calc(100vw - 32px) !important;
  border-radius: 16px !important;
  background: var(--tc-surface) !important;
}

@media (max-width: 1180px) {
  html[theme="tungstencloud"][data-tc-page="source"] .main-card-content {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  html[theme="tungstencloud"][data-tc-page="ticket"] .content_searchbar .searchbar {
    grid-template-columns: repeat(2, minmax(170px, 1fr)) !important;
  }
  html[theme="tungstencloud"][data-tc-page="recommend"] .top-statistic {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 900px) {
  html[theme="tungstencloud"][data-tc-page="source"] .main-card,
  html[theme="tungstencloud"][data-tc-page="ticket"] .main-card,
  html[theme="tungstencloud"][data-tc-page="child-account"] .clid-box,
  html[theme="tungstencloud"][data-tc-page="recommend"] .recommend-box,
  html[theme="tungstencloud"][data-tc-page="recommend"] .recommend-box-open,
  html[theme="tungstencloud"][data-tc-page="recommend"] .recommend-content,
  html[theme="tungstencloud"][data-tc-page="recommend"] .main-card {
    padding: 20px 16px 24px !important;
    border-radius: 14px !important;
  }
  html[theme="tungstencloud"][data-tc-page="source"] .box.pc {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  html[theme="tungstencloud"][data-tc-page="ticket"] .content_searchbar,
  html[theme="tungstencloud"][data-tc-page="ticket"] .content_searchbar .searchbar {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
  }
}

@media (max-width: 640px) {
  html[theme="tungstencloud"][data-tc-page="source"] .main-card-content,
  html[theme="tungstencloud"][data-tc-page="recommend"] .top-statistic {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  html[theme="tungstencloud"][data-tc-page="source"] .news-list .item {
    grid-template-columns: 84px minmax(0, 1fr) !important;
  }
  html[theme="tungstencloud"][data-tc-page="source"] .news-list .item-img {
    width: 84px !important;
    height: 60px !important;
  }
}
