body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

.card {
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  border: none;
}

.card-header {
  background-color: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
  font-weight: 500;
}

.table th {
  font-weight: 600;
  color: #495057;
}

.badge {
  font-weight: 500;
}

.btn-outline-primary:hover,
.btn-outline-success:hover {
  color: white;
}

.navbar-brand {
  font-weight: 600;
}

.progress {
  border-radius: 10px;
}

.progress-bar {
  border-radius: 10px;
  font-size: 11px;
}

.accordion-button:not(.collapsed) {
  background-color: #e7f1ff;
  color: #0c63e4;
}

.input-group-sm > .form-control {
  text-align: center;
}

.alert {
  border: none;
  border-radius: 10px;
}

.list-group-item {
  border-left: none;
  border-right: none;
}

.list-group-item:first-child {
  border-top: none;
}

.form-control:focus,
.form-select:focus {
  border-color: #86b7fe;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.15);
}

/* ===== 移动端响应式样式 ===== */

/* 小屏幕设备 (手机) */
@media (max-width: 767.98px) {
  /* 容器间距优化 */
  .container {
    padding-left: 15px;
    padding-right: 15px;
  }

  /* 页面标题和按钮组合优化 */
  .d-flex.justify-content-between.align-items-center {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 15px;
  }

  .d-flex.justify-content-between.align-items-center > div {
    width: 100%;
  }

  .d-flex.justify-content-between.align-items-center > div > .btn {
    width: 100%;
    margin-bottom: 5px;
  }

  /* 卡片优化 */
  .card {
    margin-bottom: 20px;
  }

  .card-body {
    padding: 1rem;
  }

  /* 表格移动端优化 */
  .table-responsive {
    border: none;
  }

  .table-mobile-stack {
    display: none;
  }

  .table-mobile-stack.active {
    display: block;
  }

  .table-mobile-card {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background-color: #fff;
  }

  .table-mobile-card .mobile-label {
    font-weight: 600;
    color: #495057;
    font-size: 0.875rem;
    display: inline-block;
    min-width: 80px;
  }

  .table-mobile-card .mobile-value {
    margin-left: 10px;
  }

  .table-mobile-card .mobile-row {
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
  }

  .table-mobile-card .mobile-row:last-child {
    margin-bottom: 0;
  }

  /* 隐藏桌面版表格 */
  .table-desktop {
    display: none;
  }

  /* 按钮组优化 */
  .btn-group {
    flex-direction: column;
    width: 100%;
  }

  .btn-group .btn {
    border-radius: 0.375rem !important;
    margin-bottom: 0.25rem;
  }

  /* 表单优化 */
  .form-control, .form-select {
    font-size: 16px; /* 防止iOS缩放 */
    padding: 0.75rem;
  }

  .input-group-sm > .form-control {
    font-size: 14px;
    text-align: left;
  }

  /* 导航优化 */
  .navbar-nav {
    text-align: center;
  }

  .navbar-nav .nav-link {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }

  .navbar-nav .nav-link:last-child {
    border-bottom: none;
  }

  /* 进度条优化 */
  .progress {
    width: 100% !important;
    margin-top: 0.25rem;
  }

  /* 徽章优化 */
  .badge {
    display: inline-block;
    margin: 0.125rem;
  }

  /* 分页按钮优化 */
  .btn-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    min-height: 44px; /* 触摸友好的最小尺寸 */
  }

  /* 手风琴优化 */
  .accordion-button {
    padding: 1rem;
    font-size: 0.9rem;
  }

  .accordion-body {
    padding: 1rem;
  }

  /* 登录页面优化 */
  .login-card {
    margin: 20px;
    padding: 30px 20px !important;
    max-width: none !important;
    width: calc(100% - 40px) !important;
  }

  .login-header i {
    font-size: 36px !important;
  }

  .login-header h3 {
    font-size: 1.5rem;
  }

  /* 操作按钮区域优化 */
  .action-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .action-buttons .btn {
    width: 100%;
  }
}

/* 中等屏幕设备 (平板竖屏) */
@media (min-width: 768px) and (max-width: 991.98px) {
  .container {
    max-width: 720px;
  }

  /* 表格在平板上的优化 */
  .table th, .table td {
    padding: 0.5rem;
    font-size: 0.9rem;
  }

  /* 卡片布局优化 */
  .col-md-4 {
    margin-bottom: 1rem;
  }
}

/* 触摸设备通用优化 */
@media (hover: none) and (pointer: coarse) {
  /* 触摸友好的按钮尺寸 */
  .btn {
    min-height: 44px;
    padding: 0.75rem 1rem;
  }

  .btn-sm {
    min-height: 38px;
    padding: 0.5rem 0.75rem;
  }

  /* 链接点击区域优化 */
  .nav-link, .dropdown-item {
    padding: 0.75rem 1rem;
  }

  /* 表单元素触摸优化 */
  .form-control, .form-select {
    min-height: 44px;
  }
}

/* 工具类 */
.mobile-only {
  display: none;
}

.desktop-only {
  display: block;
}

.inventory-wide-table {
  min-width: 1400px;
}

.inventory-wide-table th,
.inventory-wide-table td {
  white-space: nowrap;
  vertical-align: middle;
}

.stat-card {
  border-radius: 1rem;
}

.allocation-table .material-head {
  min-width: 220px;
  background: #f8fafc;
}

.allocation-overflow {
  background: #fff1f2 !important;
  border-color: #f43f5e !important;
}

.allocation-input.is-invalid {
  border-color: #dc3545;
  background-color: #fff5f5;
}

@media (max-width: 767.98px) {
  .mobile-only {
    display: block;
  }

  .desktop-only {
    display: none;
  }
}
