/* CRM responsive overrides. Loaded last so lazy page styles cannot restore desktop widths. */
@media (max-width: 991px) {
  html, body, #app { width: 100%; min-width: 0; }
  .login, .register { min-height: 100vh; min-height: 100dvh; height: auto !important; box-sizing: border-box; padding: 32px 16px; }
  .login .login-form, .register .register-form { width: 100% !important; max-width: 440px; height: auto !important; margin: auto !important; padding: 28px 20px 12px !important; box-sizing: border-box; }
  .login-form .el-form { margin-left: 0 !important; margin-right: 0 !important; }
  .login-form .title { font-size: 22px; line-height: 1.5; }
  .login-form .el-input__inner { font-size: 16px; }
  .login-code img { max-width: 100%; object-fit: contain; }
  #app .mobile .main-container { margin-left: 0 !important; min-width: 0; }
  #app .mobile .fixed-header { width: 100% !important; }
  .mobile .navbar .breadcrumb-container { max-width: calc(100% - 145px); overflow: hidden; white-space: nowrap; }
  .mobile .navbar .right-menu .avatar-container { margin-right: 24px; }
  .app-main { min-width: 0; }
}
@media (max-width: 767px) {
  .app-container { padding: 12px !important; min-width: 0 !important; }
  .app-container > .el-form--inline { display: flex; flex-direction: column; }
  .app-container > .el-form--inline > .el-form-item { display: flex; width: 100%; margin: 0 0 12px !important; }
  .app-container > .el-form--inline > .el-form-item > .el-form-item__label { flex: 0 0 82px; width: 82px !important; padding-right: 10px; }
  .app-container > .el-form--inline > .el-form-item > .el-form-item__content { flex: 1; min-width: 0; }
  .app-container > .el-form--inline .el-input, .app-container > .el-form--inline .el-select, .app-container > .el-form--inline .el-date-editor { width: 100% !important; max-width: 100%; }
  .el-date-editor .el-range-input { min-width: 0; }
  .app-container > .el-row { display: flex; flex-wrap: wrap; row-gap: 10px; }
  .app-container > .el-row > .el-col { width: auto; max-width: 100%; }
  .app-container .el-table { width: 100% !important; max-width: 100%; }
  .app-container .el-table__body-wrapper { overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
  .app-container .el-table__header, .app-container .el-table__body { min-width: 1000px; }
  .pagination-container { height: auto !important; padding: 16px 0 !important; overflow-x: auto; }
  .pagination-container .el-pagination { position: static !important; display: flex; flex-wrap: wrap; gap: 8px; white-space: normal; padding: 0; }
  .el-dialog { width: calc(100% - 24px) !important; max-width: 560px; margin: 5vh auto !important; }
  .el-dialog__body { padding: 16px !important; max-height: 70vh; overflow: auto; }
  .el-dialog .el-form-item__label { float: none; display: block; width: auto !important; text-align: left; }
  .el-dialog .el-form-item__content { margin-left: 0 !important; }
  .el-dialog .el-select, .el-dialog .el-date-editor { max-width: 100%; }
  .el-dialog .el-row { margin: 0 !important; }
  .el-dialog .el-col { width: 100%; padding: 0 !important; }
  .el-message-box { width: calc(100% - 32px) !important; box-sizing: border-box; }
  .el-message { min-width: 0 !important; max-width: calc(100% - 24px); }
  .el-picker-panel { max-width: calc(100vw - 16px); }
  .el-date-range-picker { width: calc(100vw - 16px) !important; max-width: 420px; }
  .el-date-range-picker__content { width: 100% !important; float: none !important; padding: 10px; }
  .el-date-range-picker__content.is-left { border-right: 0; border-bottom: 1px solid #e4e7ed; }
  .el-picker-panel__body-wrapper { max-height: 65vh; overflow-y: auto; }
  .el-picker-panel__sidebar { width: 80px; }
  .el-picker-panel__sidebar + .el-picker-panel__body { margin-left: 80px; }
  .el-drawer { max-width: 100vw; width: 100% !important; }
}

@media (max-width: 767px) {
  .app-container .crm-card-table { background: transparent; border: 0; overflow: visible; }
  .app-container .crm-card-table::before, .app-container .crm-card-table::after { display: none; }
  .app-container .crm-card-table > .el-table__header-wrapper, .app-container .crm-card-table > .el-table__fixed, .app-container .crm-card-table > .el-table__fixed-right { display: none; }
  .app-container .crm-card-table > .el-table__body-wrapper { width: 100% !important; height: auto !important; max-height: none !important; overflow: visible !important; }
  .app-container .crm-card-table .el-table__body, .app-container .crm-card-table .el-table__body > tbody { display: block; width: 100% !important; min-width: 0 !important; }
  .app-container .crm-card-table colgroup { display: none; }
  .app-container .crm-card-table .el-table__row { display: block; margin-bottom: 14px; border: 1px solid #e6eaf0; border-radius: 12px; background: #fff; box-shadow: 0 3px 12px rgba(32,45,64,.05); overflow: hidden; }
  .app-container .crm-card-table .el-table__row > td { display: flex; align-items: flex-start; gap: 12px; width: auto !important; padding: 9px 14px !important; border: 0; text-align: left; visibility: visible; background: transparent !important; }
  .app-container .crm-card-table .el-table__row > td::before { content: attr(data-card-label); flex: 0 0 76px; color: #7b8491; line-height: 24px; font-size: 13px; }
  .app-container .crm-card-table .el-table__row > td > .cell { flex: 1; min-width: 0; width: auto !important; padding: 0 !important; white-space: normal; overflow: visible; overflow-wrap: anywhere; line-height: 24px; }
  .app-container .crm-card-table .el-table__row > td:first-child:not(.el-table-column--selection) { padding-top: 14px !important; padding-bottom: 12px !important; background: #f8fafc !important; border-bottom: 1px solid #eef1f5; }
  .app-container .crm-card-table .el-table__row > td:first-child:not(.el-table-column--selection) > .cell { font-weight: 600; color: #303844; }
  .app-container .crm-card-table .el-table__row > td.crm-card-actions { border-top: 1px solid #eef1f5; padding: 10px 14px !important; }
  .app-container .crm-card-table .crm-card-actions > .cell { display: flex; flex-wrap: wrap; gap: 8px; }
  .app-container .crm-card-table .crm-card-actions .el-button { min-height: 36px; margin: 0; padding: 8px 10px; border: 1px solid #f6d9da; background: #fff7f7; border-radius: 6px; }
  .app-container .crm-card-table .el-table__empty-block { width: 100% !important; min-width: 0; min-height: 120px; border: 1px dashed #e6eaf0; border-radius: 12px; background: #fafbfc; }
  .app-container .crm-card-table .el-table__empty-text { width: 100%; }
  .app-container .crm-card-table .el-table__expanded-cell { display: block; padding: 12px !important; }
  .app-container .crm-card-table .el-table__expanded-cell::before { display: none; }
  .app-container .crm-card-selectable > .el-table__header-wrapper { display: block; margin-bottom: 10px; }
  .app-container .crm-card-selectable .el-table__header { display: block; width: 100% !important; min-width: 0 !important; }
  .app-container .crm-card-selectable .el-table__header thead, .app-container .crm-card-selectable .el-table__header tr { display: block; }
  .app-container .crm-card-selectable .el-table__header th { display: none; }
  .app-container .crm-card-selectable .el-table__header th.el-table-column--selection { display: block; border: 0; padding: 8px 14px; background: #f8fafc; }
  .app-container .crm-card-selectable .el-table__header th.el-table-column--selection .cell { display: flex; align-items: center; gap: 10px; padding: 0; }
  .app-container .crm-card-selectable .el-table__header th.el-table-column--selection .cell::after { content: '全选本页'; font-weight: 400; color: #606266; }
}
