/* 统一样式 */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f5f5f5; min-height: 100vh; }

/* 登录页 */
#loginPage { max-width: 400px; margin: 0 auto; padding: 40px 20px; }
.login-card { background: #fff; padding: 32px; border-radius: 16px; box-shadow: 0 4px 20px rgba(0,0,0,0.1); }
h1 { text-align: center; color: #333; margin-bottom: 24px; font-size: 24px; }
.form-group { margin-bottom: 16px; }
label { display: block; margin-bottom: 6px; font-weight: 600; color: #333; }
input, select, textarea { width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 14px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: #4a90d9; }
.btn { display: inline-block; padding: 12px 24px; background: #4a90d9; color: #fff; border: none; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 500; }
.btn:hover { background: #3a7bc8; }
.btn-block { width: 100%; }
.btn-outline { background: #fff; border: 2px solid #4a90d9; color: #4a90d9; }
.btn-outline:hover { background: #f0f7ff; }
.btn-success { background: #28a745; }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.error-msg { color: #dc3545; font-size: 13px; margin-bottom: 10px; display: none; }

/* 头部 */
.header { background: #fff; padding: 16px 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); display: flex; justify-content: space-between; align-items: center; max-width: 1200px; margin: 0 auto; }
.header h2 { font-size: 18px; color: #333; }
.user-info { display: flex; align-items: center; gap: 12px; }
.logout-link { color: #666; text-decoration: underline; cursor: pointer; font-size: 14px; }

/* 导航 */
.nav-bar { background: #fff; padding: 12px 20px; display: flex; gap: 8px; overflow-x: auto; max-width: 1200px; margin: 0 auto; }
.nav-item { padding: 8px 16px; border-radius: 20px; background: #f0f0f0; color: #666; text-decoration: none; font-size: 14px; white-space: nowrap; }
.nav-item:hover { background: #e0e0e0; }
.nav-item.active { background: #4a90d9; color: #fff; }

/* 统计 */
.stats-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; padding: 16px 20px; background: #f8f9fa; max-width: 1200px; margin: 0 auto; }
.stat-card { background: #fff; padding: 16px; border-radius: 12px; text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.stat-num { font-size: 28px; font-weight: bold; color: #4a90d9; }
.stat-label { font-size: 12px; color: #666; margin-top: 4px; }

/* 内容区 */
.page { padding: 20px; max-width: 800px; margin: 0 auto; }
.page-header { margin-bottom: 20px; }
.page-title { font-size: 20px; font-weight: 600; color: #333; }
.back-link { color: #4a90d9; text-decoration: none; font-size: 14px; cursor: pointer; display: inline-block; margin-bottom: 12px; }

/* 记录列表 */
.record-list { display: flex; flex-direction: column; gap: 12px; }
.record-card { background: #fff; padding: 16px; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.record-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.record-title { font-weight: 600; color: #333; }
.record-actions { display: flex; gap: 8px; }
.record-row { display: flex; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.record-field { flex: 1; min-width: 120px; }
.record-field label { font-size: 12px; color: #888; margin-bottom: 4px; }
.record-field .value { color: #333; font-size: 14px; }
.record-empty { text-align: center; padding: 40px; color: #999; }

/* 表单 */
.form-card { background: #fff; padding: 24px; border-radius: 16px; box-shadow: 0 4px 15px rgba(0,0,0,0.08); margin-bottom: 20px; }
.form-title { font-size: 16px; font-weight: 600; color: #333; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid #eee; }
.form-row { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.form-col { flex: 1; min-width: 150px; }
.form-col label { font-size: 13px; color: #666; margin-bottom: 6px; display: block; }
.btn-group { display: flex; gap: 12px; margin-top: 20px; }

/* 按钮 */
.delete-btn { color: #dc3545; background: none; border: none; cursor: pointer; font-size: 13px; padding: 4px 8px; }
.delete-btn:hover { text-decoration: underline; }
.edit-btn { color: #4a90d9; background: none; border: none; cursor: pointer; font-size: 13px; padding: 4px 8px; }
.edit-btn:hover { text-decoration: underline; }

/* 状态标签 */
.status-tag { display: inline-block; padding: 4px 10px; border-radius: 12px; font-size: 12px; }
.status-pending { background: #fff3cd; color: #856404; }
.status-arrived { background: #d4edda; color: #155724; }
.status-cancelled { background: #f8d7da; color: #721c24; }

/* Toast */
.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,0.8); color: #fff; padding: 12px 24px; border-radius: 8px; font-size: 14px; z-index: 1000; opacity: 0; transition: opacity 0.3s; }
.toast.show { opacity: 1; }

/* 汇总 */
.summary-section { background: #fff; padding: 20px; border-radius: 12px; margin-bottom: 16px; }
.summary-title { font-size: 15px; font-weight: 600; color: #333; margin-bottom: 12px; }
.summary-item { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #f0f0f0; }
.summary-item:last-child { border-bottom: none; }
.summary-label { color: #666; }
.summary-value { font-weight: 500; color: #333; }

/* 响应式 */
@media (max-width: 600px) {
  .stats-bar { grid-template-columns: repeat(2, 1fr); }
  .page { padding: 12px; }
  .header { padding: 12px; }
  .header h2 { font-size: 16px; }
  .nav-bar { padding: 8px 12px; gap: 6px; }
  .nav-item { padding: 6px 12px; font-size: 12px; }
  .form-card { padding: 12px; }
  .form-col { margin-bottom: 12px; }
  input, select, textarea { padding: 10px; font-size: 14px; }
  .btn { padding: 12px 20px; font-size: 14px; min-height: 44px; }
  .stat-card { padding: 12px; }
  .stat-num { font-size: 24px; }
  .summary-section { padding: 12px; }
  .history-item { padding: 10px; }
  .history-detail-row { font-size: 12px; }
  .history-detail-label { width: 80px; }
  /* 移动端优化 - 更大的触摸区域 */
  select, input[type="text"], input[type="tel"], input[type="date"], textarea {
    min-height: 44px;
    touch-action: manipulation;
  }
  /* 移动端表单标签优化 */
  label { font-size: 14px; margin-bottom: 8px; }
  /* 移动端按钮优化 */
  .btn-group { flex-direction: column; gap: 10px; }
  .btn-group .btn { width: 100%; }
}

/* 超小屏幕优化 */
@media (max-width: 400px) {
  .stats-bar { grid-template-columns: 1fr 1fr; gap: 8px; }
  .page { padding: 8px; }
  .header h2 { font-size: 14px; }
  .user-info { font-size: 12px; }
}

/* 文件上传样式 */
.upload-area {
  border: 2px dashed #ddd;
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  background: #fafafa;
}
.upload-area:hover {
  border-color: #4a90d9;
  background: #f0f7ff;
}
.file-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}
.file-item {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #eee;
}
.file-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.file-item .remove-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border-radius: 50%;
  font-size: 14px;
  line-height: 20px;
  text-align: center;
  cursor: pointer;
}

/*** 弹窗样式 ***/
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  z-index: 9999;
  overflow: auto;
}
.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-content {
  background: #fff;
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}
.modal-header {
  padding: 16px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h3 { margin: 0; font-size: 18px; }
.modal-close { font-size: 24px; cursor: pointer; color: #999; }
.modal-body { padding: 16px; }

/* 子菜单 */
.nav-group { position: relative; }
.sub-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  min-width: 120px;
  z-index: 1000;
  padding: 8px 0;
}
.sub-dropdown .dropdown-item {
  display: block;
  padding: 10px 16px;
  color: #333;
  text-decoration: none;
  white-space: nowrap;
  font-size: 14px;
}
.sub-dropdown .dropdown-item:hover { background: #f5f5f5; }
.sub-dropdown .dropdown-item.active { color: #667eea; font-weight: bold; }
