* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f0f2f5; }

/* 登录页 */
.login-container { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); padding: 20px; }
.login-box { background: white; padding: 40px; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); width: 100%; max-width: 400px; }
.login-box h1 { text-align: center; color: #333; margin-bottom: 30px; font-size: 24px; }
.login-box input { width: 100%; padding: 12px 16px; border: 1px solid #ddd; border-radius: 8px; font-size: 16px; margin-bottom: 16px; }
.login-box button { width: 100%; padding: 14px; background: #667eea; color: white; border: none; border-radius: 8px; font-size: 16px; cursor: pointer; }
.login-box button:hover { background: #5a6fd6; }

/* 主布局 */
.admin-container { display: none; }
.header { background: white; padding: 12px 16px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 100; }
.header h1 { font-size: 18px; color: #333; }
.header button { padding: 8px 16px; background: #ff4d4f; color: white; border: none; border-radius: 6px; cursor: pointer; font-size: 14px; }

/* 侧边栏 */
.main { display: flex; min-height: calc(100vh - 50px); }
.sidebar { width: 200px; background: white; box-shadow: 2px 0 8px rgba(0,0,0,0.1); padding: 16px 0; position: sticky; top: 50px; height: calc(100vh - 50px); overflow-y: auto; }
.sidebar a { display: block; padding: 12px 20px; color: #333; text-decoration: none; border-left: 3px solid transparent; font-size: 14px; }
.sidebar a:hover, .sidebar a.active { background: #f0f2f5; border-left-color: #667eea; color: #667eea; }

/* 内容区 */
.content { flex: 1; padding: 16px; min-width: 0; }
.card { background: white; border-radius: 8px; padding: 16px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); margin-bottom: 16px; }
.card h2 { font-size: 16px; color: #333; margin-bottom: 16px; border-bottom: 1px solid #eee; padding-bottom: 12px; }

/* 统计卡片 */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card { background: white; border-radius: 8px; padding: 16px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.stat-card h3 { font-size: 13px; color: #666; margin-bottom: 6px; }
.stat-card .value { font-size: 24px; font-weight: bold; color: #333; }

/* 表格 */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 600px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #eee; font-size: 14px; }
th { background: #fafafa; font-weight: 500; white-space: nowrap; }
tr:hover { background: #f5f5f5; }

/* 按钮 */
.btn { padding: 8px 14px; border: none; border-radius: 6px; cursor: pointer; font-size: 14px; display: inline-block; text-align: center; }
.btn-primary { background: #667eea; color: white; }
.btn-primary:hover { background: #5a6fd6; }
.btn-danger { background: #ff4d4f; color: white; }
.btn-danger:hover { background: #e64a4c; }
.btn-success { background: #52c41a; color: white; }
.btn-success:hover { background: #48a816; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; }

/* 模态框 */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000; justify-content: center; align-items: center; padding: 20px; }
.modal-content { background: white; border-radius: 12px; padding: 24px; width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto; }
.modal-content h3 { margin-bottom: 20px; font-size: 18px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; color: #333; font-size: 14px; font-weight: 500; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 10px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; }
.form-group textarea { height: 100px; resize: vertical; }
.modal-buttons { display: flex; justify-content: flex-end; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
.modal-buttons .btn { min-width: 80px; }

/* 分页 */
.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 20px; flex-wrap: wrap; }
.pagination button { padding: 8px 12px; border: 1px solid #ddd; background: white; border-radius: 4px; cursor: pointer; font-size: 14px; }
.pagination button.active { background: #667eea; color: white; border-color: #667eea; }

/* 消息提示 */
.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); padding: 12px 24px; border-radius: 8px; color: white; z-index: 2000; display: none; font-size: 14px; max-width: 90%; text-align: center; }
.toast.success { background: #52c41a; }
.toast.error { background: #ff4d4f; }

/* 移动端适配 */
@media screen and (max-width: 768px) {
    .header h1 { font-size: 16px; }
    .header button { padding: 6px 12px; font-size: 13px; }
    
    .main { flex-direction: column; }
    .sidebar { width: 100%; position: static; height: auto; display: flex; overflow-x: auto; padding: 0; }
    .sidebar a { white-space: nowrap; border-left: none; border-bottom: 3px solid transparent; padding: 12px 16px; }
    .sidebar a:hover, .sidebar a.active { border-bottom-color: #667eea; border-left-color: transparent; }
    .sidebar.open { display: flex; position: absolute; top: 50px; left: 0; right: 0; z-index: 99; box-shadow: 0 4px 8px rgba(0,0,0,0.1); flex-wrap: wrap; }
    
    .content { padding: 12px; }
    .card { padding: 12px; }
    
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .stat-card { padding: 12px; }
    .stat-card h3 { font-size: 12px; }
    .stat-card .value { font-size: 20px; }
    
    table { min-width: 500px; }
    th, td { padding: 8px 10px; font-size: 13px; }
    
    .btn { padding: 8px 12px; font-size: 13px; }
    .btn-sm { padding: 5px 8px; font-size: 11px; }
    
    .modal-content { padding: 16px; margin: 10px; }
    .modal-buttons { flex-direction: column; }
    .modal-buttons .btn { width: 100%; }
    
    .pagination button { padding: 6px 10px; font-size: 13px; }
}

@media screen and (max-width: 480px) {
    .login-box { padding: 24px; }
    .login-box h1 { font-size: 20px; margin-bottom: 20px; }
    .login-box input { padding: 10px 14px; font-size: 15px; }
    .login-box button { padding: 12px; font-size: 15px; }
    
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card { padding: 10px; }
    .stat-card h3 { font-size: 11px; }
    .stat-card .value { font-size: 18px; }
    
    .btn-group { display: flex; flex-wrap: wrap; gap: 6px; }
    .btn-group .btn { flex: 1; min-width: calc(50% - 3px); }
}

/* 触摸友好的点击区域 */
@media (hover: none) and (pointer: coarse) {
    .btn { min-height: 44px; }
    .btn-sm { min-height: 36px; }
    .sidebar a { min-height: 44px; display: flex; align-items: center; }
    th, td { padding: 12px 10px; }
    .form-group input, .form-group select, .form-group textarea { min-height: 44px; }
}

/* 横屏优化 */
@media screen and (max-width: 768px) and (orientation: landscape) {
    .sidebar { flex-wrap: nowrap; }
    .sidebar a { padding: 10px 14px; font-size: 13px; }
}
