/*
 * 客户控制台全局响应式保护层。
 * 桌面布局仍由各页面样式负责；这里只处理视口收窄后的溢出、折行和导航可达性。
 */

html,
body {
  max-width: 100%;
}

body {
  overflow-x: hidden;
}

.template,
.template > .el-container,
.template > .el-container > .el-container,
.template .el-main,
.template .main-card,
.template .content-box {
  min-width: 0;
  max-width: 100%;
}

.template > .el-container,
.template > .el-container > .el-container {
  width: 100%;
}

.template img,
.template video,
.template canvas,
.template iframe {
  max-width: 100%;
}

.template pre,
.template code {
  max-width: 100%;
}

.template pre {
  overflow-x: auto;
  white-space: pre;
  -webkit-overflow-scrolling: touch;
}

.template .el-row,
.template [class*="el-col-"] {
  min-width: 0;
  max-width: 100%;
}

.template .el-table,
.template .el-table__header-wrapper,
.template .el-table__body-wrapper,
.template .el-table__footer-wrapper {
  max-width: 100%;
}

.template .el-table__body-wrapper,
.template .el-table__footer-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.template .el-tabs,
.template .el-tabs__content,
.template .el-tab-pane {
  min-width: 0;
  max-width: 100%;
}

.template .el-input,
.template .el-select,
.template .el-cascader,
.template .el-autocomplete,
.template .el-date-editor {
  max-width: 100%;
}

.el-dialog {
  max-width: calc(100vw - 48px);
}

.el-message-box {
  max-width: calc(100vw - 32px);
}

.el-notification,
.el-message {
  max-width: calc(100vw - 32px);
}

.el-popover,
.el-select-dropdown,
.el-cascader__dropdown,
.el-picker-panel {
  max-width: calc(100vw - 24px);
}

@media screen and (max-width: 1200px) {
  .template .content-box {
    margin-right: 16px;
    margin-left: 16px;
    padding-right: 18px;
    padding-left: 18px;
  }

  .template .main-card-title.main-card-title {
    padding-right: 18px;
    padding-left: 18px;
  }

  .el-main.tc-section-main {
    --tc-section-menu-w: 184px;
  }
}

/* 平板和窄窗口把二级侧栏改为横向导航，避免直接隐藏后无法切换页面。 */
@media screen and (max-width: 900px) {
  .el-main.tc-section-main,
  .el-main.tc-section-main.tc-section-main-collapsed {
    --tc-section-menu-w: 100%;
    display: flex !important;
    flex-direction: column;
    width: 100%;
  }

  .el-main.tc-section-main > .tc-section-menu {
    position: relative;
    top: 0;
    z-index: 80;
    display: block !important;
    flex: 0 0 50px;
    width: 100%;
    height: 50px;
  }

  .el-main.tc-section-main > :not(.tc-section-menu) {
    width: 100%;
    min-width: 0;
  }

  .tc-section-menu-inner {
    flex-direction: row;
    width: 100%;
    height: 50px;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
  }

  .tc-section-menu-title,
  .tc-section-menu-mark,
  .tc-section-menu-toggle {
    display: none !important;
  }

  .tc-section-menu-list {
    display: flex;
    flex: 1 1 auto;
    align-items: stretch;
    padding: 0 8px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .tc-section-menu-item,
  .tc-section-main-collapsed .tc-section-menu-item {
    flex: 0 0 auto;
    justify-content: center;
    width: auto;
    height: 50px;
    margin: 0;
    padding: 0 16px;
    border-radius: 0;
    line-height: 50px;
  }

  .tc-section-main-collapsed .tc-section-menu-text {
    display: inline;
  }

  .tc-section-menu-icon {
    display: none;
  }

  .tc-section-menu-text {
    flex: 0 0 auto;
    overflow: visible;
  }
}

@media screen and (max-width: 750px) {
  body {
    min-width: 0;
  }

  .template .content-box {
    width: auto;
    margin-right: 12px;
    margin-left: 12px;
    padding-right: 14px;
    padding-left: 14px;
  }

  .template .main-card-title.main-card-title {
    padding-right: 14px;
    padding-left: 14px;
  }

  .template .top-action-layout,
  .template .content_searchbar,
  .template .content-searchbar,
  .template .toolbar,
  .template .table-toolbar {
    flex-wrap: wrap;
    gap: 10px;
    max-width: 100%;
  }

  .template .top-action-layout {
    margin-right: 12px;
    margin-left: 12px;
  }

  .template .el-tabs__header {
    max-width: 100%;
    overflow: hidden;
  }

  .template .el-tabs__nav-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .template .el-tabs__nav {
    float: none;
    width: max-content;
    min-width: 100%;
  }

  .template .el-tabs__item {
    flex: 0 0 auto;
  }

  .template .myPage,
  .template .el-pagination {
    max-width: 100%;
  }

  .template .el-pagination {
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .template table:not(.el-table__header):not(.el-table__body):not(.el-table__footer) {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .el-dialog {
    width: auto;
    max-width: calc(100vw - 24px);
    margin-right: 12px;
    margin-left: 12px;
  }

  .el-dialog__body {
    max-height: calc(100vh - 150px);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .el-message-box {
    width: calc(100vw - 24px);
    min-width: 0;
    max-width: calc(100vw - 24px);
  }

  .el-notification,
  .el-message {
    right: 12px !important;
    left: 12px !important;
    width: auto;
    min-width: 0;
    max-width: none;
  }

  .el-message {
    transform: none;
  }

  .el-drawer {
    max-width: 88vw;
  }

  .el-date-range-picker,
  .el-date-picker,
  .el-time-range-picker {
    max-width: calc(100vw - 24px);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .tc-fee-popover,
  .tc-account-popover,
  .tc-message-popover {
    right: 8px !important;
    left: auto !important;
    max-width: calc(100vw - 16px);
  }

  .tc-fee-card,
  .tc-account-card,
  .tc-message-popover .top-msg-box {
    max-width: 100%;
  }
}

@media screen and (max-width: 480px) {
  .template .content-box {
    margin-right: 8px;
    margin-left: 8px;
    padding-right: 12px;
    padding-left: 12px;
  }

  .template .main-card-title.main-card-title,
  .template .top-action-layout {
    margin-right: 0;
    margin-left: 0;
    padding-right: 12px;
    padding-left: 12px;
  }

  .template .el-form--inline .el-form-item {
    display: block;
    width: 100%;
    margin-right: 0;
  }

  .template .el-form--inline .el-form-item__content,
  .template .el-form--inline .el-input,
  .template .el-form--inline .el-select,
  .template .el-form--inline .el-cascader,
  .template .el-form--inline .el-date-editor {
    width: 100%;
  }

  .dialog-footer,
  .el-dialog__footer {
    flex-wrap: wrap;
  }

  .dialog-footer .el-button,
  .el-dialog__footer .el-button {
    min-width: 96px;
  }

  .tc-section-menu-item,
  .tc-section-main-collapsed .tc-section-menu-item {
    padding-right: 12px;
    padding-left: 12px;
  }
}

@media screen and (max-width: 359px) {
  .template .content-box {
    margin-right: 6px;
    margin-left: 6px;
    padding-right: 10px;
    padding-left: 10px;
  }

  .tc-section-menu-item,
  .tc-section-main-collapsed .tc-section-menu-item {
    padding-right: 10px;
    padding-left: 10px;
  }
}

@media screen and (max-height: 600px) and (orientation: landscape) {
  .el-dialog {
    margin-top: 2vh !important;
  }

  .el-dialog__body {
    max-height: calc(96vh - 110px);
  }
}
