/* ===================================
   团购核销数据统计系统 - 全局样式表
   设计规范：简约白色主调，无渐变，Inter 字体
   参考：ui-ux-pro-max 设计系统
=================================== */

/* 引入 Inter 字体（最适合数据管理类后台） */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ========================
   设计令牌（Design Tokens）
======================== */
:root {
  /* 核心色 - 简约蓝，无渐变 */
  --primary: #2563EB;
  --primary-hover: #1D4ED8;
  --primary-light: #EFF6FF;
  --primary-border: #BFDBFE;

  /* 功能色 */
  --success: #16A34A;
  --success-light: #F0FDF4;
  --warning: #D97706;
  --warning-light: #FFFBEB;
  --danger: #DC2626;
  --danger-light: #FEF2F2;
  --info: #0891B2;
  --info-light: #ECFEFF;

  /* 背景色 - 白色为主 */
  --bg: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-sidebar: #FFFFFF;
  --bg-hover: #F1F5F9;
  --bg-active: #EFF6FF;

  /* 文字色 - 高对比度 */
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  --text-sidebar: #475569;
  --text-active: #2563EB;

  /* 边框 */
  --border: #E2E8F0;
  --border-light: #F1F5F9;
  --border-sidebar: #E2E8F0;

  /* 圆角 */
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;

  /* 阴影 - 极轻，非浮夸 */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.05), 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.08), 0 4px 6px rgba(0, 0, 0, 0.04);

  /* 布局 */
  --sidebar-w: 232px;
  --topbar-h: 56px;

  /* 动效 - 克制，150-300ms */
  --transition: 0.15s ease;
  --transition-md: 0.2s ease;
}

/* ========================
   重置与基础
======================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ========================
   全局 Reset
======================== */
* {
  box-sizing: border-box;
}

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
}

/* 对所有可点击元素启用 cursor-pointer（ui-ux-pro-max 强制要求） */
button,
a,
[onclick],
[role="button"],
label[for],
select {
  cursor: pointer;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  border: none;
  background: none;
  font-family: inherit;
  font-size: inherit;
}

input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
}

table {
  border-collapse: collapse;
  width: 100%;
}

img {
  max-width: 100%;
}

/* ========================
   整体布局框架
======================== */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ========================
   侧边栏 - 白色简约版
======================== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 200;
  transition: transform var(--transition-md);
  overflow-y: auto;
  overflow-x: hidden;
}

/* 品牌 Logo 区域 */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.brand-icon {
  width: 30px;
  height: 30px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-icon svg {
  width: 16px;
  height: 16px;
  stroke: #fff;
  stroke-width: 2;
}

.brand-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

/* 侧边导航 */
.sidebar-nav {
  flex: 1;
  padding: 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nav-group-title {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 12px 8px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-sidebar);
  font-size: 13.5px;
  font-weight: 450;
  transition: all var(--transition);
}

.nav-item svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity var(--transition);
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item:hover svg {
  opacity: 1;
}

.nav-item.active {
  background: var(--bg-active);
  color: var(--text-active);
  font-weight: 500;
}

.nav-item.active svg {
  opacity: 1;
  stroke: var(--primary);
}

/* 侧边栏底部 */
.sidebar-footer {
  padding: 10px 10px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13.5px;
  transition: all var(--transition);
}

.logout-btn svg {
  width: 15px;
  height: 15px;
}

.logout-btn:hover {
  background: var(--danger-light);
  color: var(--danger);
}

/* ========================
   顶部栏（仅移动端显示）
======================== */
.topbar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  align-items: center;
  padding: 0 16px;
  z-index: 100;
  gap: 12px;
}

.topbar-title {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.menu-toggle,
.topbar-logout {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: background var(--transition);
}

.menu-toggle svg,
.topbar-logout svg {
  width: 18px;
  height: 18px;
}

.menu-toggle:hover,
.topbar-logout:hover {
  background: var(--bg-hover);
}

/* ========================
   主内容区
======================== */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 24px 28px;
  min-height: 100vh;
  max-width: calc(100vw - var(--sidebar-w));
}

/* 遮罩层（移动端侧边栏） */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 150;
  backdrop-filter: blur(2px);
}

/* ========================
   通用页面组件
======================== */

/* 页面标题区 */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.page-header-left h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.page-header-left p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* 卡片 */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-xs);
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.card-title svg {
  width: 15px;
  height: 15px;
  stroke: var(--primary);
}

/* 统计卡片网格 */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--transition-md), border-color var(--transition-md);
}

.stat-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--primary-border);
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon svg {
  width: 18px;
  height: 18px;
}

.stat-icon.blue {
  background: var(--primary-light);
  color: var(--primary);
}

.stat-icon.blue svg {
  stroke: var(--primary);
}

.stat-icon.green {
  background: var(--success-light);
  color: var(--success);
}

.stat-icon.green svg {
  stroke: var(--success);
}

.stat-icon.amber {
  background: var(--warning-light);
  color: var(--warning);
}

.stat-icon.amber svg {
  stroke: var(--warning);
}

.stat-icon.cyan {
  background: var(--info-light);
  color: var(--info);
}

.stat-icon.cyan svg {
  stroke: var(--info);
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1.5;
}

.btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-xs);
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-outline {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: #CBD5E1;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #B91C1C;
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-success:hover {
  background: #15803D;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-lg {
  padding: 10px 20px;
  font-size: 14px;
}

.btn-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* 数据表格 */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
}

.data-table {
  font-size: 13px;
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  background: #F8FAFC;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border);
  /* 加粗边框分界 */
  white-space: nowrap;
}

.data-table th,
.data-table td {
  text-align: center !important;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.data-table td {
  color: var(--text-primary);
}

/* 核心对齐补丁：强制所有深层子元素居中 */
.data-table th *,
.data-table td * {
  text-align: center !important;
  margin-left: auto !important;
  margin-right: auto !important;
  display: inline-block;
  /* 极其关键：将块级子元素转为 inline-block 以便外层 text-align 生效 */
  vertical-align: middle;
}

/* 特殊标签样式修正 */
.data-table td div,
.data-table td p,
.data-table td blockquote {
  width: auto;
  max-width: 100%;
}

.data-table td input[type="checkbox"] {
  display: inline-block !important;
  margin: 0 auto !important;
}

/* 按钮组对齐 */
.data-table .btn-group {
  display: flex !important;
  justify-content: center !important;
  align-items: center;
  gap: 6px;
  width: 100%;
}

/* 特殊情况：如果某些内容确实需要左对齐（如非常长的备注），可以保留 tl 类，但必须 th/td 同时使用 */
.data-table .tl,
.data-table .tl * {
  text-align: left !important;
  margin-left: 0 !important;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* 隔行换色 Zebra Striping */
.data-table.zebra tbody tr:nth-child(even) td {
  background: #F8FAFC;
}

.data-table tbody tr {
  transition: background var(--transition);
}

.data-table tbody tr:not(.no-hover):hover td {
  background: var(--primary-light) !important;
}

/* 徽章 */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 100px;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.6;
}

.badge-green {
  background: #DCFCE7;
  color: #15803D;
}

.badge-red {
  background: #FEE2E2;
  color: #DC2626;
}

.badge-amber {
  background: #FEF3C7;
  color: #B45309;
}

.badge-orange {
  background: #FFEDD5;
  color: #C2410C;
}

.badge-blue {
  background: var(--primary-light);
  color: var(--primary);
}

.badge-gray {
  background: #F1F5F9;
  color: var(--text-secondary);
}

/* 表单 */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 5px;
}

.form-label span {
  color: var(--danger);
  margin-left: 1px;
}

.form-control {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text-primary);
  background: var(--bg-card);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  appearance: none;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control::placeholder {
  color: var(--text-muted);
}

.form-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-grid.col-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.form-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.form-row .form-group {
  flex: 1;
  margin-bottom: 0;
}

/* 弹窗 */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.show {
  display: flex;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 500px;
  animation: modalIn 0.18s ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all var(--transition);
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal-close svg {
  width: 14px;
  height: 14px;
}

.modal-body {
  padding: 18px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
}

/* 分页 */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.pagination-info {
  font-size: 12.5px;
  color: var(--text-secondary);
}

.page-btns {
  display: flex;
  gap: 3px;
}

.page-btn {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  background: var(--bg-card);
  transition: all var(--transition);
}

.page-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.page-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 40px 20px;
}

.empty-state svg {
  width: 40px;
  height: 40px;
  margin: 0 auto 10px;
  display: block;
  stroke: var(--text-muted);
  opacity: 0.5;
}

.empty-state p {
  font-size: 13.5px;
  color: var(--text-muted);
}

/* Toast 提示 */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 15px;
  background: var(--text-primary);
  color: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  min-width: 220px;
  max-width: 320px;
  animation: toastIn 0.2s ease;
  pointer-events: auto;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(16px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.toast.success {
  border-left: 3px solid #4ADE80;
}

.toast.error {
  border-left: 3px solid #F87171;
}

.toast.info {
  border-left: 3px solid #60A5FA;
}

.toast svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

/* 筛选栏 */
.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 14px;
}

.filter-bar .form-group {
  margin-bottom: 0;
}

/* 标签页 */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  gap: 0;
  margin-bottom: 18px;
}

.tab-btn {
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--transition);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* 上传区域 */
.upload-area {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  transition: all var(--transition-md);
  background: var(--bg);
}

.upload-area:hover,
.upload-area.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.upload-area svg {
  width: 36px;
  height: 36px;
  stroke: var(--text-muted);
  margin-bottom: 10px;
}

.upload-area h3 {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.upload-area p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* 登录页 */
.login-page {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  width: 100%;
  max-width: 360px;
  box-shadow: var(--shadow);
}

.login-card .brand {
  text-align: center;
  margin-bottom: 24px;
}

.login-card .brand-logo {
  width: 44px;
  height: 44px;
  background: var(--primary);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}

.login-card .brand-logo svg {
  width: 22px;
  height: 22px;
  stroke: #fff;
}

.login-card .brand h1 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.login-card .brand p {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 3px;
}

/* 报表专用样式 */
.report-total-row td {
  background: var(--primary-light) !important;
  font-weight: 700;
  color: var(--primary) !important;
  border-top: 1px solid var(--primary-border);
}

.money {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  letter-spacing: -0.2px;
}

.money-positive {
  color: var(--success);
}

.money-negative {
  color: var(--danger);
}

/* 信息提示框 */
.alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 14px;
}

.alert svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

.alert-info {
  background: var(--primary-light);
  color: #1E40AF;
  border: 1px solid var(--primary-border);
}

.alert-warning {
  background: var(--warning-light);
  color: #92400E;
  border: 1px solid #FDE68A;
}

.alert-error {
  background: var(--danger-light);
  color: #991B1B;
  border: 1px solid #FECACA;
}

.alert-success {
  background: var(--success-light);
  color: #166534;
  border: 1px solid #BBF7D0;
}

/* prefers-reduced-motion（ui-ux-pro-max 要求） */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ========================
   响应式布局
======================== */
@media (max-width: 1024px) {
  .main-content {
    padding: 20px;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .sidebar-overlay.show {
    display: block;
  }

  .topbar {
    display: flex;
  }

  .main-content {
    margin-left: 0;
    max-width: 100vw;
    padding: 16px;
    padding-top: calc(var(--topbar-h) + 16px);
  }

  .form-grid,
  .form-grid.col-3 {
    grid-template-columns: 1fr;
  }

  .stat-grid {
    grid-template-columns: 1fr 1fr;
  }

  .page-header {
    flex-direction: column;
  }

  .filter-bar {
    flex-direction: column;
  }

  .filter-bar .form-group {
    width: 100%;
    min-width: auto;
  }

  .btn-group {
    gap: 4px;
  }

  .modal {
    max-width: 100%;
    margin: 0 4px;
  }
}

@media (max-width: 480px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .btn-sm {
    padding: 5px 8px;
    font-size: 11.5px;
  }
}

/* 访问焦点（键盘导航，ui-ux-pro-max 要求） */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ========================
   UI/UX Pro Max Custom Select
======================== */
.custom-select-wrapper {
  position: relative;
  user-select: none;
  display: inline-block;
  vertical-align: middle;
}

.custom-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all var(--transition-md);
  background: var(--bg-card);
  gap: 8px;
  padding-right: 10px;
}

.custom-select-trigger:hover {
  border-color: var(--primary-border);
}

.custom-select-trigger.open {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.custom-select-trigger.open svg {
  transform: rotate(180deg);
  color: var(--primary);
}

.custom-select-trigger svg {
  transition: transform var(--transition-md), color var(--transition);
  color: var(--text-muted);
}

.custom-select-options {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  max-height: 280px;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: all var(--transition-md);
  padding: 6px;
  white-space: nowrap;
}

.custom-select-options::-webkit-scrollbar {
  width: 6px;
}

.custom-select-options::-webkit-scrollbar-track {
  background: transparent;
}

.custom-select-options::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 3px;
}

.custom-select-options.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.custom-select-option {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-primary);
  transition: background var(--transition) ease, color var(--transition) ease;
  font-size: 13.5px;
  margin-bottom: 2px;
}

.custom-select-option:last-child {
  margin-bottom: 0;
}

.custom-select-option:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.custom-select-option.selected {
  background: var(--primary-light);
  color: var(--text-active);
  font-weight: 600;
}