/* ===== 全局滚动条美化 ===== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

/* ===== 全局搜索下拉菜单美化 ===== */
.global-search-dropdown .ant-select-item {
  padding: 10px 16px;
  border-radius: 6px;
  margin: 4px 8px;
  transition: all 0.2s;
}
.global-search-dropdown .ant-select-item:hover {
  background: linear-gradient(135deg, #e8f0fe 0%, #f0f7ff 100%);
  transform: translateX(4px);
}
.global-search-dropdown .ant-select-item-option-selected {
  background: linear-gradient(135deg, #e8f0fe 0%, #d6e9ff 100%);
  font-weight: 500;
}
.global-search-dropdown .rc-virtual-list {
  padding: 4px 0;
}

.shell-top-tools {
  align-items: center;
  line-height: normal;
}

.shell-search-slot {
  height: 28px;
  display: flex;
  align-items: center;
}

.shell-search-autocomplete.ant-select {
  display: flex;
  align-items: center;
  height: 28px;
  line-height: 28px;
}

.shell-search-input.ant-input-affix-wrapper {
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #fcfdff;
  border: 1px solid #d8e3f2;
  box-shadow: none;
}

.shell-search-input.ant-input-affix-wrapper .ant-input-prefix {
  margin-right: 8px;
  display: flex;
  align-items: center;
}

.shell-search-input.ant-input-affix-wrapper .ant-input {
  height: 26px;
  padding: 0;
  font-size: 13px;
  line-height: 26px;
  color: #24344d;
}

.shell-search-input.ant-input-affix-wrapper .ant-input::placeholder {
  color: #adb7c8;
}

.shell-user-entry {
  height: 28px;
  display: flex;
  align-items: center;
}

.shell-user-name {
  font-size: 13px;
  line-height: 28px;
  color: #28374f;
  font-weight: 600;
}

.mobile-approval-page {
  min-height: 100vh;
  padding: 24px;
  background: #f5f5f5;
}

.mobile-approval-page__inner {
  width: min(980px, 100%);
  margin: 0 auto;
}

.mobile-approval-page--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
}

/* ===== 全局移动端响应式适配 ===== */

@media screen and (max-width: 767px) {
  html,
  body,
  #root {
    max-width: 100vw;
    overflow-x: hidden;
  }

  * {
    box-sizing: border-box;
  }

  /* --- Modal: 限制最大宽度 --- */
  .ant-modal {
    width: calc(100vw - 20px) !important;
    max-width: calc(100vw - 20px) !important;
    margin: 10px auto !important;
  }
  .ant-modal .ant-modal-body {
    max-height: calc(100vh - 150px);
    overflow-y: auto;
    padding: 14px !important;
  }
  .ant-modal .ant-modal-header,
  .ant-modal .ant-modal-footer {
    padding-left: 14px !important;
    padding-right: 14px !important;
  }

  /* --- Descriptions: 强制单列 --- */
  .ant-descriptions .ant-descriptions-row {
    display: flex;
    flex-direction: column;
  }
  .ant-descriptions .ant-descriptions-row > th,
  .ant-descriptions .ant-descriptions-row > td {
    display: block;
    width: 100% !important;
    padding: 8px 12px !important;
  }
  .ant-descriptions .ant-descriptions-item {
    display: flex;
    flex-direction: column;
  }
  .ant-descriptions .ant-descriptions-item-label {
    font-weight: 600;
    color: #666;
  }
  /* bordered descriptions */
  .ant-descriptions-bordered .ant-descriptions-row > th,
  .ant-descriptions-bordered .ant-descriptions-row > td {
    border-right: none !important;
  }

  /* --- Table: 横向滚动 --- */
  .ant-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .ant-table {
    min-width: max-content;
  }
  /* 紧凑表格单元格 */
  .ant-table-cell {
    padding: 8px 6px !important;
    font-size: 13px !important;
    white-space: nowrap !important;
  }
  .ant-table-cell .ant-typography {
    font-size: 13px !important;
  }

  /* --- Form: 紧凑间距 --- */
  .ant-form-item {
    margin-bottom: 12px;
  }

  /* --- Card: 紧凑内边距 --- */
  .ant-card-body {
    padding: 12px !important;
  }
  .ant-card-head {
    padding: 0 12px !important;
    min-height: 40px !important;
  }
  .ant-card-head-title {
    font-size: 14px !important;
  }

  /* --- Tabs: 可滚动 --- */
  .ant-tabs-nav {
    margin-bottom: 8px !important;
  }

  /* --- Statistic: 紧凑 --- */
  .ant-statistic-title {
    font-size: 12px !important;
    margin-bottom: 2px !important;
  }
  .ant-statistic-content {
    font-size: 20px !important;
  }

  /* --- Space.Compact / flex layouts: 允许换行 --- */
  .ant-space-compact,
  .ant-space-horizontal {
    flex-wrap: wrap;
  }

  /* --- Drawer: 不超过屏幕宽度 --- */
  .ant-drawer-content-wrapper {
    width: 100vw !important;
    max-width: 100vw !important;
  }
  .ant-drawer-body {
    padding: 14px !important;
  }

  .ant-btn {
    min-height: 34px;
  }

  .mobile-work-page {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    padding: 0 2px;
  }

  .mobile-page-header {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }

  .mobile-page-header .ant-input-search,
  .mobile-page-header .ant-select {
    width: 100% !important;
  }

  .mobile-page-header .ant-input-search .ant-input-search-button {
    width: auto !important;
    min-width: 44px;
  }

  .mobile-toolbar,
  .mobile-action-row {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    width: 100%;
  }

  .mobile-toolbar > *,
  .mobile-action-row > * {
    flex: 1 1 calc(50% - 8px);
    min-width: 0;
  }

  .mobile-action-row .ant-space-item > .ant-btn,
  .mobile-toolbar .ant-space-item > .ant-btn,
  .mobile-action-row > .ant-btn,
  .mobile-toolbar > .ant-btn {
    width: 100%;
    padding-left: 8px;
    padding-right: 8px;
  }

  .mobile-toolbar .ant-input-search .ant-btn,
  .mobile-page-header .ant-input-search .ant-btn {
    width: auto !important;
  }

  .mobile-search-field.ant-input-search .ant-input-wrapper {
    display: flex !important;
    width: 100%;
  }

  .mobile-search-field.ant-input-search .ant-input-affix-wrapper {
    flex: 1 1 auto;
    min-width: 0;
  }

  .mobile-search-field.ant-input-search .ant-input-group-addon {
    display: block !important;
    width: 46px !important;
    flex: 0 0 46px;
  }

  .mobile-status-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    width: 100%;
  }

  .mobile-status-card {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    min-width: 0;
    min-height: 64px;
    padding: 10px;
    border: 1px solid #eef0f4;
    border-radius: 8px;
    background: #fff;
  }

  .mobile-status-card__icon {
    font-size: 22px;
    line-height: 1;
  }

  .mobile-status-card__label {
    color: #6b7280;
    font-size: 12px;
    line-height: 18px;
    white-space: nowrap;
  }

  .mobile-status-card__value {
    min-width: 0;
    margin-top: 2px;
    font-size: 14px;
    font-weight: 600;
    line-height: 20px;
    word-break: break-word;
  }

  .mobile-detail-list {
    border: 1px solid #eef0f4;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
  }

  .mobile-detail-row {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid #f2f4f7;
  }

  .mobile-detail-row:last-child {
    border-bottom: none;
  }

  .mobile-detail-label {
    color: #6b7280;
    line-height: 22px;
  }

  .mobile-detail-value {
    min-width: 0;
    color: #111827;
    line-height: 22px;
    word-break: break-word;
  }

  .mobile-record-list {
    display: grid;
    gap: 10px;
  }

  .mobile-record-card {
    border: 1px solid #eef0f4;
    border-radius: 8px;
    padding: 12px;
    background: #fff;
  }

  .mobile-record-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
  }

  .mobile-record-card__title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
  }

  .mobile-record-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
  }

  .mobile-record-card__actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
  }

  .mobile-record-card__actions .ant-btn {
    width: 100%;
  }

  .mobile-two-column-grid,
  .mobile-three-column-grid,
  .mobile-four-column-grid {
    grid-template-columns: 1fr !important;
  }

  .mobile-form-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 0 !important;
  }

  .mobile-bottom-spacer {
    padding-bottom: 72px !important;
  }

  .mobile-sticky-actions {
    position: sticky;
    bottom: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 10px 0 0;
    background: linear-gradient(180deg, rgba(255,255,255,0), #fff 20%);
  }

  .mobile-approval-page {
    padding: 10px;
  }

  .mobile-approval-page--empty {
    padding: 40px 10px;
  }

  .approval-review-mobile .ant-card {
    border-radius: 8px;
  }

  .approval-review-mobile .ant-card-head {
    min-height: 42px;
    padding: 0 12px;
  }

  .approval-review-mobile .ant-card-head-title {
    padding: 10px 0;
    font-size: 15px;
    line-height: 22px;
    white-space: normal;
  }

  .approval-review-mobile .ant-card-body {
    padding: 12px;
  }

  .approval-review-mobile .mobile-detail-row {
    grid-template-columns: 86px minmax(0, 1fr);
  }

  .approval-mobile-item-list {
    margin-top: 10px;
  }

  .approval-mobile-actions {
    position: sticky;
    bottom: 0;
    z-index: 12;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding-top: 10px;
    background: linear-gradient(180deg, rgba(255,255,255,0), #fff 24%);
  }

  .approval-mobile-actions .ant-btn {
    height: 42px;
    font-size: 15px;
  }

  /* --- 通用工具类 --- */
  /* 隐藏手机端不需要的元素 */
  .hide-on-mobile {
    display: none !important;
  }

  /* Grid三栏布局适配(PMC等) */
  .mobile-stack {
    grid-template-columns: 1fr !important;
  }
}

/* 桌面端隐藏 */
@media screen and (min-width: 768px) {
  .hide-on-desktop {
    display: none !important;
  }
}
